jj20051 Posted November 18, 2008 Share Posted November 18, 2008 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; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/133230-solved-delete-row-help/ Share on other sites More sharing options...
dropfaith Posted November 18, 2008 Share Posted November 18, 2008 try to echo sql echo $sql; or this as your delete function mysql_query("DELETE FROM new WHERE name = '$name'") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/133230-solved-delete-row-help/#findComment-692899 Share on other sites More sharing options...
revraz Posted November 18, 2008 Share Posted November 18, 2008 Missing single quotes. Should use mysql_error after each query. $sql = "DELETE FROM new WHERE name='$name'"; Quote Link to comment https://forums.phpfreaks.com/topic/133230-solved-delete-row-help/#findComment-692900 Share on other sites More sharing options...
jj20051 Posted November 18, 2008 Author Share Posted November 18, 2008 Thnks!!! Quote Link to comment https://forums.phpfreaks.com/topic/133230-solved-delete-row-help/#findComment-692901 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.