Establish variables to be used with query data
I have this code:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "___", "___") or die(mysql_error());
mysql_select_db("____") or die(mysql_error());
// Retrieve all the data from the "TECH" table
$result = mysql_query("SELECT * FROM tech WHERE ID='".$_POST['tech']."'") or die(mysql_error());
// Print out the contents of the entry
while($row = mysql_fetch_array($result)){
echo $row['NAME']. " - ". $row['ID']. " - ". $row['ALLOW']. " - ". $row['TEAM']. " - ". $row['LOCA'];
echo "<br />";
}
?>
How would I do the exact same thing except instead of echo the information there, how do I establish variables for the 5 items to be used later in the php code? Or do I simply use $row['NAME'] ?
Thanks for any help. Total noob working with this for the first time. Just trying to learn.
Subject
Written By
Posted
Establish variables to be used with query data
March 15, 2009 10:16PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.