similar to a previous post i put on here but this time instead of typing a query in a text box, how would i do it with a drop down menu?just need to list certain fields from one of the tables. here is the code to list all the fields in the table.
<?php
/*Script to display all full-time jobs in the full time job table
/*Open the database connection and use the findacareer database
$link = mysql_connect(“localhost”, “root”, “”)
or die(“No local host connection:”. mysql_error());
mysql_select_db(“findacareer”)
or die(“Could not select the database”);
/*Perform SQL Query
$query = “SELECT * FROM fulltime”;
$result = mysql_query($query);
or die(“Query failed:”.mysql_error());
echo “nt<h1>Full Time Positions</h1>n”;
/*Print the results in HTML
print “<table border=1>n<tr>n”;
echo “nt<th>Reference Number:</th>”;
echo “nt<th>Salary:</th>”;
echo “nt<th>Location:</th>”;
echo “nt<th>Arrangement:</th>”;
echo “nt<th>Sector:</th>”;
echo “nt<th>Contact Name:</th>”;
echo “nt<th>Email:</th>”;
“n</tr>”;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
print “t<tr>n”;
foreach ($line as $col_value)
{
print “tt<td ALIGN = center>$col_value</td>n”;
}
print “t</tr>n”;
}
print “</table>n”;
mysql_free_result($result);
echo “<br>”;
echo “<br>”;
/*Perform SQL Query
$query = “SELECT * FROM customer”;
$result = mysql_query($query);
or die(“Query failed:”.mysql_error());
echo “nt<h1>Customer</h1>n”;
//Print the results in HTML
print “<table border=1>n<tr>n”;
echo “nt<th>Reference Number:</th>”;
echo “nt<th>Name:</th>”;
echo “nt<th>Age:</th>”;
echo “nt<th>Sex:</th>”;
echo “nt<th>Email:</th>”;
echo “nt<th>Phone:</th>”;
echo “nt<th>City:</th>”;
“n</tr>”;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
print “t<tr>n”;
foreach ($line as $col_value)
{
print “tt<td ALIGN = center>$col_value</td>n”;
}
print “t</tr>n”;
}
print “</table>n”;
mysql_free_result($result);
/* Close connection
mysql_close($link);
?>
cheers