Your Ad Here

Thursday, March 26, 2009

Question about how PHP treats things fetched via MySQL

Code:
---------
$sql = "SELECT * FROM `table` WHERE `XXX` = '$YYY'";
$result = mysql_query($sql);
$info = mysql_fetch_assoc($result);
---------
I've got this part down, and it works well enough, where I'm confused, however, is how PHP handles it if MySQL sends back more than one row. Does it create a multi-dimensional array (e.g. $info[1][id], $info[2][id]), or does it treat it some other way? How can I pick through the results sent back from MySQL to find the specific row I want at the moment without modifying the initial call?

Read More...
Your Ad Here

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.