question about how PHP handles mySQL query results
Posted: Mon Jul 12, 2004 4:53 pm
I'm a newb, I admit it.
but I gotta' know why this doesn't work:
Is there a means of getting the results by using PHP's ability to handle multidimensional arrays?
did this make any sense? lol
Thanks
but I gotta' know why this doesn't work:
Code: Select all
mysql_connect ("host", "user", "pass");
mysql_select_db ("DB");
$qryImage = mysql_query ("SELECT strImageURL FROM TableImages WHERE intArtistID = 3 ORDER BY dateCreated DESC");
$numResults = mysql_num_rows ($qryImage);
echo $numResults; // echo is fine... prints the expected result
// the WHILE statement works fine too
while ($row = mysql_fetch_array($qryImage)) {
echo '<pre>';
echo $row['strImageURL'];
echo '</pre>';
}
// why can't I get the results of the query to work in the below example?
$row = mysql_fetch_row ($qryImage);
echo $row[0]['strImageURL'];
echo $row[1]['strImageURL'];
echo $row[2]['strImageURL'];
?>did this make any sense? lol
Thanks