Re: Resource Id #2
| From: | Dan Brunner | Date: | Wed, 23 Jan 2002 19:01:47 +0000 |
| Subject: | Re: Resource Id #2 | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16111@lists.php.net to get a copy of this message | ||
Good, I'm glad it worked!!!
I see a lot of people using mysql_fetch_array().....
Which is fine...But I'm more into Object Oriented programming...and that's why I always use mysql_fetch_object()....
Good luck!!!
Dan
On Wednesday, January 23, 2002, at 11:45 AM, joshwhar@cc.usu.edu wrote:
My thanks for your quick response! Here's the problem I'm dealing with: I am inserting info with a unique identifier that auto-increments, then take that ID and place it into another table for later reference. I was trying to use something like: $query="select var1 from table1 where var2='$var3'and var4='$var5'";$somevar=mysql_query($query) or die.. yada yada echo $somevar; I tried your code, and it works wonderfully! Thanks so much. :) J. Wharton jwharton@cc.usu.edu ----- Original Message ----- From: "Dan Brunner" <daniel.brunner@desteracs.com> To: <joshwhar@cc.usu.edu> Cc: <php-db@lists.php.net> Sent: Wednesday, January 23, 2002 12:21 PM Subject: Re: [PHP-DB] Resource Id #2Use something like this... ... ... ... $rows = mysql_num_rows($result); for ($y = 0; $y < $rows; $y++){ $data = mysql_fetch_object($result); echo $data->Field_Name; ... ... ... } A Little more code would Help!!! On Wednesday, January 23, 2002, at 10:56 AM, joshwhar@cc.usu.edu wrote:I'm having a problem with retrieving data from MySQL databases. I can input with no problems, but when I try to pull the data back out (single field) and echo it I get something showing up saying Resource Id #2. Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list- admin@lists.php.net