This delete function still isn't working.
I want it to create an archive table with the same name attached with the timestamp if the id isn't new, however it doesn't even create a table with the name inventory_time.
function delete_cart($id, $bu) {
/
$time=date("D, d M Y H:i:s O");
$sql="SELECT count(*) AS cnt FROM order.inventory ";
$sql.="WHERE id='$id' AND bu='$bu'";
$result=mysql_query($sql);
if ( !$result ) {die("<font color='red'>Invalid query:</font>" . mysql_error() . "<br />$sql");}
$dbarray = mysql_fetch_array($result);
if ( $dbarry['cnt']>0 ){
$sql="CREATE TABLE order.inventory_time SELECT * FROM order.inventory";
$result=mysql_query($sql);
var_dump($result). "RESULT <br />";
if ( !$result ) die("<font color='red'>Invalid query:</font>" . mysql_error() . "<br />$sql");
$sql="DELETE FROM order.inventory WHERE id=$id AND bu= $bu";
$result=mysql_query($sql);
if ( !$result ) die("<font color='red'>Invalid query:</font>" . mysql_error() . "<br />$sql");
echo "The old id: $id has been deleted</b>";
}
}
thanks,