This is a discussion on an easy one i'm apparently too tired to fix... within the alt.comp.lang.php forums, part of the PHP Programming Forums category; this block is included by my index.php if the user has selected a category ($catID) of products to view... $...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
this block is included by my index.php if the user has selected a category
($catID) of products to view... $db = mysql_connect($host, $dbuser, $dbpass) or die("no connection"); mysql_select_db($dbase,$db); $sql = "SELECT * FROM product WHERE CategoryID ='$catID' and featured='Y' ORDER BY ProductName LIMIT 12"; echo $sql; $result = mysql_query($sql,$db); //this is just so I can generate a new <tr> when 3 columns have been displayed $numCols=0; echo "<table><tr><td>"; while ($myrow = mysql_fetch_array($result)) { Astonishingly, it works when catID=1 but not catID=2. I took the sql statement that got echoed when catID=2 and pasted it into phpmyadmin, and it retrieved the record correctly. So the data is there. And it works, like I said, for catID=1. So the connection is there. Can you see any red flags? |
|
|||
|
"Matthew Crouch" <matthew.crouch@spamlessverizon.net> schreef in bericht news:_8Wnb.5046$Q9.1599@nwrddc02.gnilink.net... > > Astonishingly, it works when catID=1 but not catID=2. I took the sql > statement that got echoed when catID=2 and pasted it into phpmyadmin, and it > retrieved the record correctly. So the data is there. And it works, like I > said, for catID=1. So the connection is there. Can you see any red flags? > > One option would be, that your website runs on another version then phpmyadmin does (are you developing on localhost)? Another option would be, that permissions deny the user to access the table through your page, while you are logging into phpmyadmin as root. Try some debugging by appending 'or die(mysql_error())' after each mysql_* function call. Good night ;-) JW |
|
|||
|
Thanks for replying. it was something different, though...which I'll share
for amusement value (amazing what a good nap will do for you): I had to make a copy of the dB awhile back and was looking at the old one through phpmyadmin. So when I said the data is definitely there, I was being hasty. I was looking for data that I had added since the copy. bye "Janwillem Borleffs" <jw@jwscripts.com> wrote in message news:3fa03c12$0$209$1b62eedf@news.euronet.nl... > > "Matthew Crouch" <matthew.crouch@spamlessverizon.net> schreef in bericht > news:_8Wnb.5046$Q9.1599@nwrddc02.gnilink.net... > > > > Astonishingly, it works when catID=1 but not catID=2. I took the sql > > statement that got echoed when catID=2 and pasted it into phpmyadmin, and > it > > retrieved the record correctly. So the data is there. And it works, like I > > said, for catID=1. So the connection is there. Can you see any red flags? > > > > > > One option would be, that your website runs on another version then > phpmyadmin does (are you developing on localhost)? > > Another option would be, that permissions deny the user to access the table > through your page, while you are logging into phpmyadmin as root. > > Try some debugging by appending 'or die(mysql_error())' after each mysql_* > function call. > > > Good night ;-) > > JW > > > |