[PHP-DB] RE: [PHP] Lost in query... Trying to get output from query....
Hi, You need to loop through the returned recordset and use the returned result(s). Instead of: $admin_get_options_result = mysql_fetch_assoc($admin_get_options_results_reference); Try: While ($admin_get_options_result = mysql_fetch_assoc($admin_get_options_results_reference)){ echo p The api# .$admin_get_options_result[adminpageid]. allows you to .$admin_get_options_result[description]., and uses the file .$admin_get_options_result[filename]./p; } Mysql_free_result($admin_get_options_results_reference); Hope this helps... Much warmth, Murray -Original Message- From: GH [mailto:[EMAIL PROTECTED] Sent: Tuesday, 12 October 2004 12:59 AM To: PHP General; [EMAIL PROTECTED] Subject: [PHP] Lost in query... Trying to get output from query Greetings: I am having a problem with trying to get data out of my mySql database. I run my query which works fine and everything... I use: $admin_get_options_query_text = Select * from adminpage; $admin_get_options_results_reference = mysql_query($admin_get_options_query_text,$db_access) or die(Admin Get Options: . mysql_error()); $admin_get_options_result = mysql_fetch_assoc($admin_get_options_results_reference); - When I run the query in mysql directly the results are. mysql Select * from adminpage; +-++ --+ | adminpageid | file_name | description | +-++ --+ | 101 | nycalertstatus.php | Change New York City Threat Alert Status | +-++ --+ 1 row in set (0.00 sec) my problem is that I would like to get that output into my php codeI would like to have something that goes like this for each record.. The api# $adminpageid allows you to $description, and uses the file #file_name can anyone please assist. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Lost in query... Trying to get output from query....
GH wrote: Greetings: I am having a problem with trying to get data out of my mySql database. I run my query which works fine and everything... I use: $admin_get_options_query_text = Select * from adminpage; $admin_get_options_results_reference = mysql_query($admin_get_options_query_text,$db_access) or die(Admin Get Options: . mysql_error()); $admin_get_options_result = mysql_fetch_assoc($admin_get_options_results_reference); If the query is going to return multiple rows, you need to loop thru the result set... while ( $admin_get_options_result = mysql_fetch_assoc($admin_get_options_results_reference) ) { // do stuff with each row returned } -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Lost in query... Trying to get output from query....
Thank You Murray's suggestion worked On Mon, 11 Oct 2004 11:20:57 -0400, John Nichel [EMAIL PROTECTED] wrote: GH wrote: Greetings: I am having a problem with trying to get data out of my mySql database. I run my query which works fine and everything... I use: $admin_get_options_query_text = Select * from adminpage; $admin_get_options_results_reference = mysql_query($admin_get_options_query_text,$db_access) or die(Admin Get Options: . mysql_error()); $admin_get_options_result = mysql_fetch_assoc($admin_get_options_results_reference); If the query is going to return multiple rows, you need to loop thru the result set... while ( $admin_get_options_result = mysql_fetch_assoc($admin_get_options_results_reference) ) { // do stuff with each row returned } -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php