I've just got a basic query to delete the fields for a certain user, determined by a dropdown form on a previous page. I've tested the $_POST['Username'] with an echo and that is working fine, but as soon as I add the query it all goes blank, no error message or anything. Here the source:
PHP Code:
<?php
// MySQL Connection Info
$server = "localhost"; // Server Name
$username = "#"; // MySQL Username
$password = "#"; // MySQL Password
$dbname = "w#"; // Database Name
// MySQL Connect String
$con = mysql_connect("$server","$username","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Select the database
mysql_select_db("$dbname");
if (!mysql_select_db)
{
die('Could not select database: ' . mysql_error());
}
$deleteuser = $_POST['Username'];
echo 'Hello ' . $deleteuser;
$eraseuser = mysql_query("DELETE FROM users WHERE Username = '" . $deleteuser . "'");
if (!$eraseuser) {
die ( 'Delete unsuccessful: ' . mysql_error())
};
?>
PS: If you spot any bad coding I can rectify please let me know, just starting to learn this stuff ;P