php - record won't delete from database -


i trying delete record using php database. supposed happen when click button, no error displayed , query appears on screen record remains on database

phpmyadmin gives me following code use: delete 'the shop'.'customer' 'customer'.'customerid' = 8

<?php $host="localhost"; // host name $tbl_name="customer"; // table name $db_user="root"; $db_pass="";  $connect = mysql_connect("$host", "$db_user", "$db_pass"); $db_name="the_shop"; // database name mysql_select_db("$db_name"); if (!$connect)  {  die("mysql not connect!");  }  if(isset($_get['submit2'])){  $db_username = $_get['username'];  $sql4 = "delete 'the_shop'.'customer' 'customer'.'customerid' = 8" or die('error deleting record'); mysql_query($sql4); echo $sql4; } ?> 

i know delete record has customerid = 8 intention once works replace customerid username , '8' relevant variable given value via form

any appreciated

use this,it working. <?php $host="localhost"; // host name $tbl_name="customer"; // table name $db_user="root"; $db_pass="";  $connect = mysql_connect("$host", "$db_user", "$db_pass"); $db_name="the_shop"; // database name mysql_select_db("$db_name",$connect); if (!$connect) {  die("mysql not connect!");   }  if(isset($_get['submit2'])){  $db_username = $_get['username'];  $sql4 = "delete `the_shop`.`customer` `customer`.`customerid` = 8";  mysql_query($sql4,$connect) or die('error deleting record'); echo $sql4; } 

?>


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -