Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.