Trouble running a select query against a database, when I know the connection is working, and the data is there

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to simply just loop through a set of records to spit out <li /> tags for the data therein, and on the same page, it's successfully running another query against the same connection - which I have also tried turning off just in case it was a problem with running two queries against the same connection (really don't think so), but it just tells me there are no records being returned, although I have tried simplifying the sql statement, pulling records from another table, etc. etc., and I really don't know what am doing wrong with this really simple bit of scripting:

$qry = mysql_query("select CatName from tblCats where Id = " . $_REQUEST['id']);
$arr = mysql_fetch_array($qry);
echo "<h2>" . $arr['CatName'] . "</h2>";
//that part works fine
$sql = "select Id, CatID, LinkName, LinkDescription, LinkURL from tblLinks where CatID = " . $_REQUEST['id'] . ";"; //the SQL statement seems to come out fine as well if I echo it out to the browser
$qry = mysql_query($sql);
$arr = mysql_fetch_array($qry);
if ($arr.count > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($arr))
 {
echo "<li>" . $row['LinkName'] . " - " . $row['LinkDescription'] . " - ";
echo "<a href='" . $row['LinkURL'] . "' target='_blank'>" . $row['LinkURL'] . "</a></li>";
 }
echo "</ul>";
}
else
{
echo "no links in category";
}
mysql_close($con);


It permanently just keeps on deciding there are no rows to output, so I'm a bit confused at the moment.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'


__________ Information from ESET NOD32 Antivirus, version of virus signature database 5023 (20100412) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux