how to use list/menu in selecting a database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
wags245
Forum Newbie
Posts: 2
Joined: Wed Oct 13, 2010 2:34 pm

how to use list/menu in selecting a database

Post by wags245 »

i really have a problem in selecting my database
i made a online purchasing and rendering service but i kind the got problem on selecting my stock this is my code

if ($_POST['GO']) {
switch($items) {
case 'tshirt':
$result = mysql_connect(Select * from tshirt);
while ($row = mysql_fetch_assoc($result)){
echo "<table>";
echo "<tr>";
echo "<td>";
echo "$row[stockID]";
echo "</td>";
echo "<td>";
echo "$row[itemQuality]";
echo "</td>";
echo "<td>";
echo "$row[ItemAmount]";
echo "</td>";
echo "<td>";
echo "$row[ItemPricet]";
echo "</td>";
echo "</tr>";
echo "</table>"
}
break;
case 'mugs':
$result = mysql_connect(Select * from mugs);
while ($row = mysql_fetch_assoc($result)){
echo "<table>";
echo "<tr>";
echo "<td>";
echo "$row[stockID]";
echo "</td>";
echo "<td>";
echo "$row[itemQuality]";
echo "</td>";
echo "<td>";
echo "$row[ItemAmount]";
echo "</td>";
echo "<td>";
echo "$row[ItemPricet]";
echo "</td>";
echo "</tr>";
echo "</table>"
}
break;
}

and here's my form

<form action="stocks.php" method="post">
<select name="item">
<option value="tshirt">Tshirt</option>
<option value="mugs">Mugs</option>
</select>
</form>
Post Reply