You are here: Re: Rookie PHP/MySQL Question « All PHP « IT news, forums, messages
Re: Rookie PHP/MySQL Question

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация