tqla Posted June 21, 2007 Share Posted June 21, 2007 I have the form below with an email field that should get passed through to the next form. <body> <form name="form1" method="post" action="expiredresetscript.php"> email address: <input name="email" type="text" id="email"> <input type="submit" name="Submit" value="Submit"> </form> </body> This form below is supposed to take that email and update a table called Member with a new password and is also supposed to update the dayCounter column with a new timestamp. <?php require_once('Connections/Auth.php'); $connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) or die ("Couldn't connect to server."); $db = mysql_select_db($database_Auth, $connection) or die ("Couldn't select database."); $date=time(); mysql_query('UPDATE `Member` SET `password` = shop, `dayCounter` = $date WHERE `email` = $_POST['email']); echo 'The password is now shop.'; ?> It doesn't seem to work. Can someone take a look at this and tell me where I've gone bad? Thank you! Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/ Share on other sites More sharing options...
pocobueno1388 Posted June 21, 2007 Share Posted June 21, 2007 Try this: <?php mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `email` = ".$_POST['email']."")or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/#findComment-279425 Share on other sites More sharing options...
tqla Posted June 21, 2007 Author Share Posted June 21, 2007 Perfect! Thanks Poco! Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/#findComment-279442 Share on other sites More sharing options...
tqla Posted June 21, 2007 Author Share Posted June 21, 2007 I spoke too soon. It did not work after all. Can some take a look at this and see where I'm going wrong now? Here's my Form: <body><form name="form1" method="post" action="expiredpwscript.php"> email address: <input name="email" type="text" id="email"> <input type="submit" name="Submit" value="Submit"> </form> </body> Here's to script: <?php require_once('../Connections/Auth.php'); $connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) or die ("Couldn't connect to server."); $db = mysql_select_db($database_Auth, $connection) or die ("Couldn't select database."); $date=time(); mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `email` = ".$_POST['email']."")or die(mysql_error()); echo 'The password is now shop.'; ?> I put in my email and get this error: You have an error in your SQL syntax near '@myemail.com' at line 1 Thanks. Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/#findComment-279537 Share on other sites More sharing options...
trecool999 Posted June 21, 2007 Share Posted June 21, 2007 I spoke too soon. It did not work after all. Can some take a look at this and see where I'm going wrong now? Here's my Form: <body><form name="form1" method="post" action="expiredpwscript.php"> email address: <input name="email" type="text" id="email"> <input type="submit" name="Submit" value="Submit"> </form> </body> Here's to script: <?php require_once('../Connections/Auth.php'); $connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) or die ("Couldn't connect to server."); $db = mysql_select_db($database_Auth, $connection) or die ("Couldn't select database."); $date=time(); mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `email` = ".$_POST['email']."")or die(mysql_error()); echo 'The password is now shop.'; ?> I put in my email and get this error: You have an error in your SQL syntax near '@myemail.com' at line 1 Thanks. For as much as I can see, the @ symbol seems to causing the problem... Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/#findComment-279540 Share on other sites More sharing options...
tqla Posted June 21, 2007 Author Share Posted June 21, 2007 Thanks Trecool999. I thought about what you said and changed the script to: FORM: <form name="form1" method="post" action="expiredpwscript.php"> User Name: <input name="loginName" type="text" id="loginName"> <input type="submit" name="Submit" value="Submit"> </form> SCRIPT: <?php require_once('../Connections/Auth.php'); $connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) or die ("Couldn't connect to server."); $db = mysql_select_db($database_Auth, $connection) or die ("Couldn't select database."); $date=time(); mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `loginName` = ".$_POST['loginName']."")or die(mysql_error()); echo 'The password is now shop.'; ?> The result is now: Unknown column 'test' in 'where clause' That's weird. There is no column called 'test'. That is the name of a user's `loginName` in the Member DB table. `Test` is what I put in the form. I want to change Test's password to "shop" and update the `dayCounter` with a new timestamp. I need help! Thanks. Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/#findComment-279563 Share on other sites More sharing options...
pocobueno1388 Posted June 21, 2007 Share Posted June 21, 2007 Hmmm....try this: <?php mysql_query("UPDATE `Member` SET `password` = 'shop', `dayCounter` = ".$date." WHERE `loginName` = '".$_POST['loginName']."'")or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/#findComment-279594 Share on other sites More sharing options...
tqla Posted June 21, 2007 Author Share Posted June 21, 2007 That was it! It was missing a ' ! Thanks pocobueno1388! You da man! ;D Link to comment https://forums.phpfreaks.com/topic/56575-solved-updating-password-question/#findComment-279614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.