Displaying Query Results from a Drop Down List

Hello. I hope somoene can help me with this. I am VERY new to using PHP. I am trying to wade through my PHP for Dummies book to get a query done. I have code on my home page that references MySQL database and list categories. There is a “Select Category” button. When a user clicks on the Select Category button, it opens a page called processform.php. On this page, I want to be able to display the results from the query. I FINALLY have the drop down list created. I am them trying to create code on my processform.php code to create the table and display the results but have really hit a wall. I am trying to extrapolate code from examples in my PHP book but it really isn’t working. I hope someone can point me in the right direction and tell me if I am doing anything right. The following is what I have so far on my processform.php. The variable that is being looked up is a field called Category. There will then be fields called Business_Name, Phone, and City. If I am completely off in my code, can someone please point me somewhere where I can read code that makes sense to a beginner (or recommend another book other than the “For Dummies” book?) Thanks for your help!

[code]
$user = “***”;
$host = “**";
$password = "";
$database = "
”;

$cxn = mysql_connect($host,$user,$password)
or die (“couldn’t connect to server”);
mysql_select_db($database,$cxn);

$query = “SELECT * FROM Clients WHERE Category=”{$_POST[‘Category’]}"";
$result = mysql_query($query,$cxn);

/* Display Results In A Table */

echo “

”;
echo “n”;
while($row = mysql_fetch_assoc($result))
echo " n";
echo " n";
echo " n";[/code]

MOD EDIT: Added code tags


{$row[‘Business_Name’]}{$row[‘Street’]}{$row[‘City’]}

First of all: what is is not doing that it should do? What is it doing instead? Are you getting any errors? Have you tried debugging, as per the link in my signature?

Thank you for your reply. I have sinced figured it out. I am going to post another question so if you want to take a look at that and try to help, I would appreciate it. It has to deal with displaying column headings.
Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service