Jump to content

Why wont this delete data?


hopbop

Recommended Posts

hello i have this code here to delete people form a call list but it is not deleting form it  could I get a some help?

 

the form

<?php
						include '../config.php';
						$query="SELECT * FROM call_list WHERE ecs = 'Jam' order by date desc";
						$result=mysql_query($query);
						echo mysql_error();
						//////////////// Now we will display the returned records in side the rows of the table/////////
						while($row = mysql_fetch_array($result))
						{
						echo "
							<table id='call_list'>
								<form name='Call_delet' action='del.php' method='get'>
									<tr>
										<td class='call_names'>
											$row[Fname] $row[Lname]
										</td>
										<td class='call_numbers'>
											$row[phone]
										</td>
										<td class='call_email'>
											$row[email]
										</td>
										<td class='call_email'>
											$row[calltime]
										</td>
										<td>
											<a href='del.php?del=$row[id]'>Del</a>
										</td>
									</tr>
								</form>
							</table>
						";
						}
					?>

del.php page

 

<?php	
include '../config.php';
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$id = $_GET['id'];
$result = mysql_query("DELETE FROM call_list WHERE id=$id")
or die(mysql_error()); 
header("Location: view.php");
}
else
{
echo"dident work";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/260939-why-wont-this-delete-data/
Share on other sites

1. echo $_GET['id']

2. try putting single quotes around $id in your query

 

 

thank you for the reply this did help me once I tryed to echo $_GET['id'] i came to the thought that it's not declared id in the url but del so once i cuckeld a bit and my head went to my desk hard (been trying to fig this out for 2 hours ) i replaced $_GET['id'] with $_GET['del'] now it all works thank you ......... I think i need to sleep more lol  :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.