Re: [PHP-DB] resource id #2, #3, #4...... From: Jason Wong (phplist <email protected>)
Date: 11/28/01

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. */

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>