Ok I am trying to delete records from a database using an html form. I have 2 files, file one = remove.php3 which queries the database table and displays the current contents. Code is as follows. <?php require '../scripts/db.php'; $result = mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not execute query, please try again later"); echo "<table border=\"0\" class=\"table-body\" width=\"100%\"><form name=\"rem_inv\" method=\"post\" action=\"done2.php3\"> <tr><td align=\"center\" colspan=\"3\"><font size=\"4\"><B>Current Inventory</B></font><hr color=\"333333\"></td></tr>"; $count = -1; while ($myrow = mysql_fetch_row($result)) { $count ++; echo "<tr><td width=\"30%\"><B>Type Of Car: </B></td><td>"; printf(mysql_result($result,$count,"car_type")); echo "</td><td><input type=\"checkbox\" name=\"cars\" value=\"checkbox\">remove</td> </tr>\n"; echo "<tr><td width=\"30%\"><B>Model Of Car: </B></td><td>"; printf(mysql_result($result,$count,"car_model")); echo "</td></tr>\n"; echo "<tr><td width=\"30%\"><B>Year Of Car: </B></td><td>"; printf(mysql_result($result,$count,"car_year")); echo "</td></tr>\n"; echo "<tr><td width=\"30%\"><B>Price Of Car: </B></td><td>$"; printf(mysql_result($result,$count,"car_price")); echo "</td></tr>\n"; echo "<tr><td width=\"30%\"><B>VIN Of Car: </B></td><td>"; printf(mysql_result($result,$count,"car_vin")); echo "</td></tr><tr><td colspan=\"3\"><hr color=\"333333\"></td></tr>\n"; } echo "<tr><td><input type=\"submit\" name=\"delete\" value=\"delete\"></td></tr></form></table>"; ?> Once it queries the database it gives the user an option to check the checkbox and delete that record. Here is the done2.php3 page that actually contains the delete sql statement.... $db_name = "test"; $table_name = "inventory"; $connection = @mysql_connect("localhost", "root", "password") or die ("Could not connect to database. Please try again later."); $db = @mysql_select_db("$db_name",$connection) or die ("Could not select database table. Please try again later."); $sql = "DELETE FROM $table_name WHERE $cars = \"$car_type\",\"$car_model\",\"$car_year\",\"$car_price\",\"$car_vin\",\"$dl r_num\""); $result = @mysql_query($sql, $connection) or die ("Could not execute query. Please try again later.");
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php