RE: [PHP] Lost in query... Trying to get output from query....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:GaryHotko@xxxxxxxxx] 
Sent: Tuesday, 12 October 2004 12:59 AM
To: PHP General; php-db@xxxxxxxxxxxxx
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
code....I 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux