Hi,
I am new to coding using PHP. Im basically on the fast track learning as much as possible. I have been playing round, and got to the stage where i have a script, that inserts data in to a table. Upon completing that task, I want to take things a little further, and create a form, where i can enter the data to remove a record.
So going by what i learnt so far, using the insert.php as a guide, i attempted to create a form in the same manner using the following script for the form:
<!--START HTML REMOVE USER FORM-->
<html>
<body>
<br>
<br>
<br>
<u><b>User Account Management:</b></u>
<form action="delete.php" method="post">
Username: <input type="text" name="username" />
<br>
E-Mail Address: <input type="text" name="email" />
<br>
<br>
<input type="submit" name="remove" value="Remove Record!" />
</form>
<!--END HTML EDIT USER FORM-->
I then created a "delete.php" file with the following script:
<?php
$con = mysql_connect("localhost","***_***","**********");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("hockley_apgame", $con);
mysql_query("DELETE FROM users WHERE username='$_POST[username]'");
mysql_query("DELETE FROM users WHERE email='$_POST[email]'");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Account Successfully Removed!";
mysql_close($con)
?>
the table is called " users" and the database is called "hockley_apgame"
When I attempt to run that, i get the error message "Query is empty"
as you can see, im attempting to use the data from the form via $_POST.
But evidently its not being recognized. What am i missing, or am i going about this completely wrong?
Sorry if this seems like a stupid question like i said, im pretty new to scripting in PHP (Tho i feel i have made a little progress in my first 24hrs,on and off, of coding)
thx
=mufar=