Jump to content

mySQL delete and refresh


envexlabs

Recommended Posts

Hey,

 

I've been able to get AJAX to delete a row in a mysql table, but how would i make the PHP file show that the row has been deleted?

 

index.php

[$query = mysql_query('SELECT * FROM `testing`');

while($i = mysql_fetch_row($query))
{
    echo $i[0] . "<br />";
    echo $i[1] . "<br />";
    echo $i[2] . "<br />";
    echo '<a href="javascript: MyAjaxRequest(\'main\',\'hello.php?ID=' . $i[2] .'\')">Delete</a><br />';
    
}

?>/code]

[color=red]hello.php[/color]
[code]if($_GET[iD] == "")
{
    echo "nothing";
}else{
    $delete = mysql_query('DELETE FROM `testing` WHERE ID = ' . $_GET[iD] . '');
}

 

Thanks,

 

envex[/code]

Link to comment
https://forums.phpfreaks.com/topic/51853-mysql-delete-and-refresh/
Share on other sites

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.