Posted by Scott Johnson on 11/29/05 16:20
Ian Rutgers wrote:
> In querying a database
>
> ($result=query_db("SELECT photo_dir, photo_name FROM photograph_photo WHERE
> photo_dir = '$dirToCheck'");
>
> is $result an array (where I could used a "in_array() function)?
>
> Thanks,
>
> Ian
>
>
No the result is basicly a pointer to an external resource.
You need to use an additional function to put that external resource
into a usable value.
The best way I find is to use (depending on the DB your using, there are
different usages for each DB supported) is mysql_fetch_array($result)
But with this you will need to step through the $result if more then one
row is found.
while($row = mysql_fetch_array($result)){
foreach($row as $key => $vlaue){
echo "Key: ".$key." (Value: ".$value.")";
}
}
Hope this helps. If not post back.
Scott
[Back to original message]
|