Re: New to PHP Need Help
| From: | Mike Flynn | Date: | Thu, 04 Apr 2002 16:35:48 +0000 |
| Subject: | Re: New to PHP Need Help | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12934@lists.php.net to get a copy of this message | ||
mysql_fetch_row() returns an associative array containing all columns retrieved from the database. You can't echo an array directly. In the associative array, the keys are the column names from the table, the values are the values you retrieved in that row.
So you could do this to see what you have:
...all the same code...
$Location_Info = mysql_fetch_row($result);
foreach($Location_Info as $key => $value) {
echo "$key: $value<br>\n";
}
That would display the row. There's tons of tutorials on basic PHP<->MySQL stuff like this out on the web. I recommend checking webmonkey.com, zend.com, phpbuilder.com, devshed.com.
Also, it's not great etiquette to send your message to multiple listservs at once.
-Mike
At 09:29 AM 4/4/2002 -0600, Jason Tobias wrote:
I am trying to define variables through an anchor tag to retrive data from MySQL, When the script runs it displays Array. I am running WIN2K and IIS 5 echo "<a href=location.php?location=2>Camp Street Cafe</a>"; Here is the script that is called. <?php $db = mysql_connect("localhost", "", "") or die ("Could not connect to Localhost"); mysql_select_db ("ETM", $db) or die ("Could not connect to the Database"); $table = "locations"; $location = ($_REQUEST["location"]); $query = "Select * from $table where Location_ID = $location"; $result= mysql_query($query); $Location_Info = mysql_fetch_row($result); echo "<p>$Location_Info"; ?> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpMike Flynn - Burlington, VT http://www.mikeflynn.net/ - mike@mikeflynn.net home=>work=>home=>store=>home [repeat daily]