Jump to content

[SOLVED] Delete Row HELP!


jj20051

Recommended Posts

Ok I Made this Script To Display All The New Users. Long and Short I Made A Way to Delete The Users, and It Appears To Work, but It Never Deletes The User, but It Does Say 'Row Deleted' and The Username Of that Person... My Code Is Bellow:

???

 

<?php

$day=date("j");

mysql_connect("localhost", "billing2_admin", "a3a471") or die(mysql_error());
mysql_select_db("billing2_ptc") or die(mysql_error());


$query = "SELECT * FROM new"; 

$result = mysql_query($query) or die(mysql_error());

echo '<center><table border="1" width="800"><tr><td><strong>Name:</strong></td><td><strong>Site Requested:</strong></td><td><strong>Paid:</strong></td></tr>';
while($row = mysql_fetch_array($result)){
echo '<tr><td width="30%">';
if ($row['paid'] == 1){
$paid = 'YES';
}
else {
$paid = 'NO';
}
echo $row['name']. "</td><td width='60%'>". $row['site']. "</td><td width='10%'>". $paid;
echo "</td></tr>";
echo '<a href="login_success.php?id=new&cmd=delete&name='.$row['name'].'">Delete</a>';
}
echo '</table></center>';

if($_GET['cmd']=="delete")
{
$name = $_GET['name']; 
$sql = "DELETE FROM new WHERE name=$name";
$result = mysql_query($sql);
echo "row deleted!";
echo $name;
} 
?> 

Link to comment
https://forums.phpfreaks.com/topic/133230-solved-delete-row-help/
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.