Re: [PHP] Code Not entering the value in the Database
- From: sandortamas@xxxxxxxxxxx (Sándor Tamás (HostWare Kft . ))
- Date: Tue, 20 Jan 2009 15:40:29 +0100
Did I miss something, or you really left the execution of the last $sql?
After you put the 'INSERT INTO...' string in $sql, you have to mysql_query it, or you won't get any result.
----- Original Message ----- From: "Chris Carter" <chandan9sharma@xxxxxxxxx>
Sent: Tuesday, January 20, 2009 3:34 PM
Subject: [PHP] Code Not entering the value in the Database
My code is not giving error but not doing the desired action.
I need to append a value in database just when the user logs in after
entering the username and password. So I am not presenting the user with a
account but just a thank you page.
1) User enters the user name and password
2) The login form contains a hidden field with a data
3) After hitting the Submit button the username and password is checked.
4) The hidden data is entered in the database.
5) A mail is sent to the user and he gets a Thank You page.
6) If verification fails then he gets a registeration page.
Here is the code, I have been struggling with:
//include file for db entries, this part is working fine
$conn = mysql_connect($host, $user, $password) or die(mysql_error());
$db = mysql_select_db($dbName, $conn) or die(mysql_error());
// insert new entry in the database if entry submitted
$emailAddress = $_POST['emailAddress'];
$password = $_POST['password'];
//$_SESSION['testing'] = $_POST['emailAddress'];
// insert new entry into database
$sql5 = "SELECT * FROM userstable WHERE emailAddress='$emailAddress' AND
password = '$password'";
// Mysql_num_row is counting table row
// If result matched $myusername and $mypassword, table row must be 1 row
$rowset5 = mysql_fetch_array($result5);
$emailAddress = $rowset5['emailAddress'];
$password = $rowset5['password'];
//Email body that is sent to the logged in user.
$body = "Hello $fName\n\nThank You for participating";
$sql = "insert into `userstable` (hiddendata) VALUES ('$hiddendata')";
mail($emailAddress, "Thank you for interest", $body, "From: abc@xxxxxxx");
What exactly am I missing.
Thanks in advance,
View this message in context: http://www.nabble.com/Code-Not-entering-the-value-in-the-Database-tp21564252p21564252.html
Sent from the PHP - General mailing list archive at Nabble.com.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
- Prev by Date: session mysteriously killed
- Next by Date: Re: [PHP] Code Not entering the value in the Database
- Previous by thread: session mysteriously killed
- Next by thread: Re: [PHP] Code Not entering the value in the Database