Can someone tell me how I can find out why I am getting errors executing
queries when I try to delete items from a table?  I have 2 files...
file 1. - Queries database, displays results with option to delete record
using a check box, 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=\"".$myrow[id]."\">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>";
?>
file 2. - takes variable of checkbox and then queries db trying to delete
any record based on the id.  code is as follows...
<?php
require '../scripts/db.php';
$sql = @mysql_query("DELETE FROM $table_name WHERE $id = 'id'",$dbh) or
die("Could not execute query, please try again later");
print("changes made");
?>
I have been trying everything under the sun and cannot get this to work.
please help.
Jas



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to