Jump to content

Deleting Row


pcw

Recommended Posts

Hi, I am using this link to delete a row from a mysql database:

 

<a href='admin.php?cmd=delete&username=".$row['username']."'>Delete</a>

 

This successfully carries over the username to delete and runs the script below, but it is not deleting the row from the database.

 

<?php
if($_GET["cmd"]=="delete")
{
include_once("data/required.php");
mysql_connect("$hostname", $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());

    $query = "DELETE FROM profiles WHERE username='$username'";
    $result = mysql_query($query);
    echo "Row deleted!";
}
?>

 

Any help is much appreciated

Link to comment
https://forums.phpfreaks.com/topic/149645-deleting-row/
Share on other sites

If you develop and debug your code on a system with error_reporting set to E_ALL and display_errors set to ON you will get immediate feedback about variables that are not being set in your code and other problems that php detects that will help you develop and debug your code quicker.

Link to comment
https://forums.phpfreaks.com/topic/149645-deleting-row/#findComment-785804
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.