PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<form method="POST" action="edit.php">
<table border="0" width="100%" id="table3">
<tr>
<td colspan="2">
<p align="center"><font face="Arial">If you would like to end
your membership with TidBitFacts.com, please type your email
below!</font></td>
</tr>
<tr>
<td align="right" width="50%"><font face="Arial">Your Email
Address:</font></td>
<td align="left">
<input type="text" name="delemail" size="25" style="border: 1px solid #C0C0C0"></td>
</tr>
</table>
<p align="center">
<input type="submit" value="deleteaccount" name="deleteaccount" style="border: 1px solid #000000"></p>
</form>
<? mysql_connect("localhost","awegweg","wegwelone") or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("adsfadsfh") or die ("Unable to select requested database.");
if($_POST[deleteaccount]) {
$id=$_COOKIE[id]
DELETE FROM members WHERE id='$id';
}
?>
<?php
if($_POST[deleteaccount]) { //No ' and '
$id=$_COOKIE[id]; //Here neither, also, you forgot the ;
DELETE FROM members WHERE id='$id'; //Where are you queryeing?
}
?>
<?php
if ($_POST['deleteaccount']) {
$id = $_COOKIE['id'];
$query = "DELETE * FROM members WHERE id='$id'"; // Not sure about the star (*), since im a beginner at MySQL
mysql_query($query); // You need to query it
}
?>
BTW, where are you checking the email? didn't you just show it for us, or have you frogt it? from what i can see, the email filed isn't needed
<?php
if ($_POST['deleteaccount']) {
$id = $_COOKIE['id'];
$query = "DELETE FROM members WHERE id='$id'"; // No star needed.
mysql_query($query); // You need to query it
}
?>
<?php
if ($_POST['deleteaccount']) {
$id = $_COOKIE['id'];
$query = mysql_query("DELETE FROM members WHERE id='$id'"); // No need to set up a variable and then query it.. just query it straight away!
}
?>
<?php
if($_POST[deleteaccount]) {
mysql_connect("localhost","awegweg","wegwelone")
or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("adsfadsfh")
or die ("Unable to select requested database.");
$id = $_COOKIE['id'];
$query = mysql_query("DELETE FROM members WHERE id='$id'");
}
?>