Re: [PHP-DB] Resource id #5

[email protected] (Stut)
Newsgroups php.db
Message-ID <[email protected]>
On 27 Mar 2008, at 17:51, Richard Dunne wrote:
> Can someone explain how I can translate Resource id #5 which is what  
> I am getting from the code below?
>
> $result = mysql_query("Select answer from answers") or  
> die(mysql_error());
> $resultArray = explode(',',$result);
> for ($i=0;$i<sizeof($resultArray);$i++)
> {
> 	echo $resultArray[$i];
> }

For the love of $DEITY, please read the frickin' manual: http://php.net/mysql 
. You've been asking similar questions around this topic for the past  
few days and you clearly haven't moved forward in your understanding.

The mysql_query function returns a resource. If you print a resource  
you get the text "Resource id #n" where n is replaced with its ID. To  
make use of this resource you need to use functions like  
mysql_fetch_array, mysql_fetch_assoc or one of the many others  
detailed in, you guessed it, the manual. Try it, you might like it.

-Stut

-- 
http://stut.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.