chokies12 Posted July 30, 2009 Share Posted July 30, 2009 here's my code i doesnt delete anything from the database <html> <head> <title>Select</title> </head> <body> <form name="form1" method="post" action="select.php"> <table width="537" border="0"> <tr> <th width="1" scope="row"> </th> <td width="126"> </td> <td width="300"> </td> <td width="92"> </td> </tr> <tr> <th scope="row"> </th> <td>Enter Lastname: </td> <td><label> <input name="keyword" type="text" id="keyword" size="50"> </label></td> <td><input name="submit" type="submit" id="submit" value="Search"></td> </tr> <tr> <th scope="row"> </th> <td> </td> <td><label></label></td> <td> </td> </tr> </table> </form> <table border="1"> <div align="center"></div> <tr> <th>LastName</th> <th>FirstName</th> <th>MiddleName</th> <th>Action</th> </tr> </body> </html> <?php include('inc/function.php'); extract($_POST); if(isset($submit)) { //$keyword = strtolower($keyword); $result = mysql_query("SELECT * FROM student_applicant_information WHERE ppd_lastname='$keyword'"); if(mysql_num_rows($result)){ while($rs = mysql_fetch_array($result)){ $studID = $rs[0]; $lastname = $rs[2]; $firstname = $rs[3]; $midname = $rs[4]; echo "<tr>"; echo "<td>$lastname</td>"; echo "<td>$firstname</td>"; echo "<td>$midname</td>"; echo "<td><a href='select.php?a=delete&id=$studID'>Delete</a> <a href='select.php?a=edit&id$studID'>Edit</a></td>"; echo "</tr>"; } } mysql_close($dbConn); echo "</table>"; } if($_GET['a'] == 'delete') { $id = $_GET['id']; $sql = "DELETE * FROM student_applicant_information WHERE stud_applicant_id=$id"; $result = mysql_query($sql); } if($_GET['a'] == 'eidt') { echo "hello world"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/168073-solved-delete-doesnt-execute-whats-wrong/ Share on other sites More sharing options...
p2grace Posted July 30, 2009 Share Posted July 30, 2009 Your query should be: $sql = "DELETE FROM student_applicant_information WHERE stud_applicant_id=$id"; No asterisk. Quote Link to comment https://forums.phpfreaks.com/topic/168073-solved-delete-doesnt-execute-whats-wrong/#findComment-886490 Share on other sites More sharing options...
chokies12 Posted July 30, 2009 Author Share Posted July 30, 2009 Your query should be: $sql = "DELETE FROM student_applicant_information WHERE stud_applicant_id=$id"; No asterisk. o thanks my fault i dont read that much..thanks dude Quote Link to comment https://forums.phpfreaks.com/topic/168073-solved-delete-doesnt-execute-whats-wrong/#findComment-886495 Share on other sites More sharing options...
p2grace Posted July 30, 2009 Share Posted July 30, 2009 No problem... could you mark the topic as solved? Cheers, p2grace Quote Link to comment https://forums.phpfreaks.com/topic/168073-solved-delete-doesnt-execute-whats-wrong/#findComment-886497 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.