Welcome to WebmasterWorld Guest from 188.8.131.52 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Help Please puckparches
Can someone please take a look a this code and give an idea what i'm soing wrong. I;m trying to deleate a record but I can do it.
//session_start(); include_once("mysql_connect.php"); $myConn = connect_db();
$serviceid = $_POST['serviceid'];
$delete = mysql_query("DELETE * FROM service WHERE service_id = $serviceid);
mysql_query($strSQL, $myConn) or die (mysql_error());
echo "<script>alert('" . $intIndex . " Service Deleted!');</script>"; echo "<script>location.href='mycar.php';</script>";
I get a syntax error unexpected '>'
Thank you any help.
service_id = $serviceid);
service_id = '$serviceid'");
try that maybe...
Try something like this:
<? //connect to db $serviceid = $_POST['serviceid']; $query = "DELETE FROM service WHERE service_id = $serviceid"; mysql_query($query) or die (mysql_error()); ?> <script> alert("<? echo $intIndex;?>Service Deleted!"); location.href='mycar.php'; </script> <? //rest of code ?>
When I programatically delete from a DB, I prefer to limit the damage risk by adding in a LIMIT to how many rows could be deleted. I'm also a fan of backticking everything.
$query = "DELETE FROM `service` WHERE `service_id` = $serviceid LIMIT 1";
Just in case... ;)