Re: resource id #2, #3, #4......

From: Date: Wed, 28 Nov 2001 17:48:56 +0000
Subject: Re: resource id #2, #3, #4......
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14665@lists.php.net to get a copy of this message
On Thursday 29 November 2001 01:29, Kevin Ruiz wrote: > I've come across yet another problem. [snip] > $ci = "select contactid from users where username='$username' and > password='$password'"; > $cir = mysql_query($ci) > or die("Couldn't execute"); > $query = "select * from my_contacts where contactid='$cir'"; > > $result = mysql_query($query) or > die( mysql_error() ); > > When I try to print $cir to see if anything's getting passed I keep getting > something that reads "resource id #2". [snip] > Does anyone know what this means and how I can work around it. $cir does NOT contain the actual results of your query. It is only a *pointer* to your results. To get at the actual result(s): print "<table>\n"; while ($line = mysql_fetch_array($cir)) { print "\t<tr>\n"; while(list($col_name, $col_value) = each($line)) { print "\t\t<td>$col_value</td>\n"; } print "\t</tr>\n"; } print "</table>\n"; Read the manual for full details. hth -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Total strangers need love, too; and I'm stranger than most. */

« previous php.db (#14665) next »