Jump to content

Recommended Posts

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

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.

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...

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.