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!
<?php
$password = crypt($_GET["pword"]);
$code = $_GET["code"];
$connection = mysql_connect("************","*********","********");
if ($connection) {
mysql_select_db("**********", $connection);
$result = mysql_query("SELECT * FROM newpassword WHERE code='$code'");//does get implemented
$accounts = mysql_num_rows($result);
if ($accounts > 0) {
$fields = mysql_fetch_row($result);
$email = $fields[1];
mysql_query("UPDATE accounts SET password='$password' WHERE email='$email'");//does not get implemented
mysql_query("DELETE * FROM newpassword WHERE code='$code'");//does not get implemented
fopen('example.txt', 'w');//does get implemented
}
}
mysql_close($connection);
?>
regarding: mysql_query("UPDATE accounts SET password='$password' WHERE email='$email'");
echo out your variable to make sure everything is set. echo out both $password and $email. Make sure they actually exist AND that you have matching data types in your database.
regarding: mysql_query("DELETE * FROM newpassword WHERE code='$code'");//does not get implemented
You have the syntax wrong. The DELETE command deletes the whole record so you don't need the *.
Try this instead: mysql_query("DELETE FROM newpassword WHERE code='$code'");