Forum Moderators: coopster
OK when customer clicks "create member" they are sent an email thanking them if all when right during signup. NOW THAT WORKS!
My problems are:
1.) My database does not show that they signed up, therefore when they login, they are told that there information does not exist.
---> There is something that is stopping the data from reaching the MySql database. NOTE THAT I am using PHP myadmin 2.8.0.2 and MYsql 4.1.2.
THE CODE I AM USING WORKED PERFECT WITH PHP myadmin 2.6.3 and Mysql 4.0.25
Also I get this error message at found at the top of the page that the NEW MEMBER is sent to after they sign up (it send them to the member only section) (although there information didn't go into the database succesfully)
"Warning: extract() [function.extract]: First argument should be an array in /home/wholesal/public_html/first.php on line 25
"
BELOW IS THE PHP code found on the page in which the customer is WELCOMED after SIGNING UP. This is the page where the error message appears. Line 25 is at the very end of the code.
-------------------------
session_start(); # 7
include('library/config.php'); #14
if ($_SESSION['auth']!= "yes") # 9
{
header('Location: index.php');
exit();
}
$connection = mysql_connect($host,$user,$password)
or die ("Couldn’t connect to server."); #16
$db = mysql_select_db($database, $connection)
or die ("Couldn’t select database.");
$sql = "SELECT firstName,lastName FROM Member
WHERE loginName='{$_SESSION['logname']}'";
$result = mysql_query($sql)
or die("Couldn’t execute query 1.");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
extract($row);
?> (LINE 25)
----------------------
Any help would be much appreciated. Thank you and have a great day.
-------------------
else #141
{
$today = date("Y-m-d"); #143
$sql = "INSERT INTO Member (loginName,createDate,
password,firstName,lastName,street,city,
state,zip) VALUES ('$newname','$today',password('$newpass'),
'$firstName', '$lastName','$street','$city',
'$state','$zip')";
mysql_query($sql); #150
$_SESSION['auth']="yes"; #151
$_SESSION['logname'] = $newname; #152
/* send email to new member */ #153
$emess = "A new Member Account has been setup. ";
$emess.= "Your new Member ID and password are: ";
$emess.= "\n\n\t$newname\n\t$newpass\n\n";
$emess.= "We appreciate your interest in us";
$emess.= " at www.website.com. \n\n";
$emess.= "If you have any questions or problems,";
$emess.= " email cs@website.com";
$ehead="From: newaccount@website.com\r\n"; #161
$subj = "New Membership Information for you";
$mailsend=mail("$newname","$subj","$emess","$ehead");
header('Location: first.php'); #164
}
include('index2.php');
?>
if the db is empty then the problem is in the insert
mysql_query($sql); #150
change to
mysql_query($sql) or die('<p>' . mysql_error()); #150
if the insert is dying that will give you the actual error message from mysql
you could also add a line above that like so
echo '<p>',$sql;
that will show you the actual insert you are sending
as far as the extract error goes, that is unrelated to the insert issue, whatever you are passing it is not an array and it must be an array
the versions of phpmyadmin and mysql don't really matter, did you recently upgrade php on your server? what version of php is it?
wild guess, php upgraded and now register_globals is off.
Global was turned off, and that solved another problem, but it did not solve the insert and empty database.
I really don't know what the problem was, but I was playing around with the code and database settings and nothing seemed to work, so I DELETED the TABLE in MySql and made table "Member" over again from scratch, making sure to put the correct values for NULL and Not NULL, for default the only thing I had labeled in the DEFAULT section was the 00-00-0000 for Date and I left the rest blank.
NOW, for some reason, that I don't Know IT WORKS PERFECT. Thanks for all the help. I will remember that information about Arrays and use that principle in my next projects (and this one if it Fails again).
Thanks and have a good one.
Regards,
Djtwo