View Full Version : Quick question on printing out results from my_sql

05-23-2004, 10:09 PM
$list_man = "SELECT Manufacturer FROM Manufacturers";

That is my query statment which is getting all the data from under the Manufacturer column from the Manufacturers table. I'm not totally sure on how to print out the results... I'm having all sorts of problems with the while loop

$list_man = "SELECT Manufacturer FROM Manufacturers";

function run_query($query) {
$Result = mysql_query ($query) or die(mysql_error());

if ($Result) {
echo "<select name='Category' id='Category'>";
while ($Row = mysql_fetch_array($Result)) { echo "<option>$Row['Manufacturer']</option>"; }
} else {
echo "The query could not be executed!";

mysql_close ($link);
print ("</select>");

I don't want to become a pest and keep asking simple question but I have no clue where to go to find out more indepth information on query statements and how to print out the results of them using PHP. I tried reading the mysql reference section on their site but I just get confused even more on how to convert the sql statement slightly to work in php because the syntax they are giving me is for the query statements to use in the mysql control manager.

05-23-2004, 10:15 PM
nvm, after playing around with the coding for awhile reading my past coding and the php manual i found out i screwed up my echo statement it should have been: echo "<option>".$Row['Manufacturer']."</option>";

but, if you still have other websites to read up on mysql query statements and php that would be greatly appreciated it will save me and you the time of reading simple questions that could be answered by myself without bugging you guys all the time.