Thanks for your suggestion. I'm going to give that a try. I'm new to
PHP so I'm still trying to figure out how things should be set up. Here my code so far. It just queries and displays two selected fields from all records in the database.
- Code: Select all
<?php
$db="DATABASE";
$link = mysql_connect("localhost","USERNAME","PASSWORD");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT Order_Number,Bill_Email_Address FROM Orders" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
Here is what I have now.
- Code: Select all
<?php
$db="DATABASE";
$link = mysql_connect("localhost","USERNAME","PASSWORD");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$query = "SELECT Bill_Email_Address FROM Orders WHERE Order_Number='$order_id'";
$result = mysql_query($query) or die("Couldn't execute query");
$row= mysql_fetch_array($result);
$email = $row["Bill_Email_Address"];
print "Working with Order Number: ";
echo "$order_id<br />";
print "Sending update to ";
echo "$email<br />";
mysql_close($link);
?>
Worked great! Thanks Bronic.