here i have written to delete using javascript......
it is "del.php"
also is the "delete.php"Code:<script> function fundel(sno) { rv=confirm("u want to delete"); if(rv==true) { location="delete.php?seno="+sno; } } </script> <table border="2"> <?php mysql_connect("localhost","root",""); mysql_select_db("test"); $data=mysql_query("select * from emp"); while($rec=mysql_fetch_row($data)) { echo "<tr><td>$rec[0]<td>$rec[1]<td>$rec[2]</tr> <input type="button" value="delete" onclick='fundel($rec[2])'>"; } ?>
it is displaying the error as Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\del.php on line 19Code:<?php $qs=$_REQUEST['seno']; mysql_connect("localhost","root",""); mysql_select_db("test"); mysql_query("delete from emp where sno=$qs"); header("location:getrec.php"); ?>
tell me what went wrong....
whether it will delete the values.....



Reply With Quote

Bookmarks