Delete a Row in a table
Posted: Mon Oct 04, 2010 11:33 am
I have used the below code to delete a row in the table and it's not working..
Can anybody help me out
<?php
<input name="delete" type="button" id="delete" value="Delete" onclick="delete()">
<br />
<br />
</label></td>
</tr><?php
$count=mysql_num_rows($qryselect);
echo $count;
// Check if delete button active, start this
function delete(){
echo "working";
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
echo $del_id;
$sql = "DELETE FROM tbl_project WHERE id='$del_id'";
$result = mysql_query($sql);
}
// if successful redirect to delete_multiple.php
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete.php\">";
}
}
?>
Can anybody help me out
<?php
<input name="delete" type="button" id="delete" value="Delete" onclick="delete()">
<br />
<br />
</label></td>
</tr><?php
$count=mysql_num_rows($qryselect);
echo $count;
// Check if delete button active, start this
function delete(){
echo "working";
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
echo $del_id;
$sql = "DELETE FROM tbl_project WHERE id='$del_id'";
$result = mysql_query($sql);
}
// if successful redirect to delete_multiple.php
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete.php\">";
}
}
?>