user6538098 user6538098 - 1 year ago 69
SQL Question

how can i delete the records from database in php

I have created one link on different page (Delete). after that i wrote following code to execute query but somehow it showing 'success' message but its not deleting particular record from database...any suggestion??

$sql = "DELETE FROM driver_info where id=$id";
echo $sql;
if(!$sql ) {
echo '<script language="javascript">';
echo 'alert("something went Wrong...:(((("); location.href="user-profile.php"';
echo '</script>';
echstrong texto '<script language="javascript">';
echo 'alert("successfully Deleted!!!"); location.href="user-profile.php"';
echo '</script>';

Answer Source

somehow it showing 'success' message but its not deleting

Because you are only echoing the query. Stop using mysql_*, instead do it with mysqli, and use mysqli_query.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download