Thanks.
Will try it out - think the .count is just related to $arr being sort of an
array of records - and think I got it out of the PHP tutorial from
w3schools.com, and it's worked on other pages.
Anyway, the following does now seem to work fine:
$qry = mysql_query($sql);
if (mysql_num_rows($qry) > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($qry))
{
echo "<li>" . $row['LinkName'] . " - " . $row['LinkDescription'] . " - ";
echo "<a href='" . $row['LinkURL'] . "' target='_blank'>" . $row['LinkURL'] .
"</a></li>";
}
echo "</ul>";
}
Thanks again
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message -----
From: Ferenc Kovacs
To: Jacob Kruger
Sent: Tuesday, April 13, 2010 10:46 AM
Subject: Re: [PHP-WIN] Trouble running a select query against a database,
when I know the connection is working, and the data is there
On Tue, Apr 13, 2010 at 10:36 AM, Jacob Kruger <[email protected]> wrote:
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)
where did you get that $arr.count thingie?
you can count the result rows with mysql_num_rows
http://www.php.net/manual/en/function.mysql-num-rows.php
Tyrael
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5023 (20100412) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5024 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com