-3

I'm working with sql on php and I get Resource id #...,

For e.g. Resource id #21,

What does it mean? and where can I find a table with all the meaning of these ids?

Thanks

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Emma
  • 149
  • 2
  • 8
  • Could you expand your question? We need more info. – juergen d Aug 03 '12 at 07:47
  • Can you show the code? It looks like you are printing the resource returned by mysql_query, instead of passing it to mysql_fetch_array or mysql_fetch_assoc. – user1498339 Aug 03 '12 at 07:48
  • Resource #... have you used mysql_fetch_array to read the returned Resource? – Stoia Alex Aug 03 '12 at 07:49
  • It seems like you have tried echo'ing the result of a `mysql_query` or `mysqli_query` instead of using `mysql_fetch_array` or similar. – Gavin Aug 03 '12 at 07:50
  • Welcome to stackoverflow! Before you begin, you may read this article: http://stackoverflow.com/questions/how-to-answer/. Now, post your code please. – Fabio Mora Aug 03 '12 at 07:50
  • 1
    possible duplicate of [How do i "echo" a "Resource id #6" from a MySql response in PHP?](http://stackoverflow.com/questions/4290108/how-do-i-echo-a-resource-id-6-from-a-mysql-response-in-php) – MvG Nov 07 '12 at 10:18

1 Answers1

1

You have to fetch your actual result from received via mysql_query() command result. For example after code

 $res = mysql_query("some query");

This returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data.

Example:

$row = mysql_fetch_array($res, MYSQL_ASSOC);

If you need more then one row from your result you have to use loops.

The documentation regarding usage of these functions you can find here: http://php.net/manual/en/ref.mysql.php

user15
  • 1,044
  • 10
  • 20
  • worth mentioning that (a) the OP didn't specify which DB he's using, and (b) even if he is using MySQL, he shouldn't be using the `mysql_xx` functions. Use PDO or `mysqli_xx` functions instead. – Spudley Aug 03 '12 at 19:59