A
Anonymous
Guest
I am making a members area of my site. I can connect to MySQL but I cannot add users to it. Here is the code for my form handler that does the work. Only names have been changed.
I have been working on this problem for several days now and would appreciate any help.
Thanks,
Lee
Code:
<?
include("header.txt");
include("constantfile.file");
//connect to database
$con = mysql_connect ($g_databasehost,$g_dbuid,$g_dbpwd);
if ($con==NULL)
{
echo("301 Couldn't connect to MySQL\n\n");
exit(-1);
}
$db = mysql_select_db ($g_databasename,$con);
$t="INSERT INTO users (userid,username,password,FirstName,LastName,email)" . "VALUES ('', '$username', '$password', '$FirstName', '$LastName', '$email')";
$sql=sprintf ($t, mysql_escape_string ($username), mysql_escape_string ($password), mysql_escape_string ($FirstName), mysql_escape_string ($LastName), mysql_escape_string ($email));
//debug
//echo($sql);
mysql_query ($sql,$con);
//autoresponder to visitor
mail ($email,"Welcome to our Member Area!","Thank You for submiting your information.");
?>
I have been working on this problem for several days now and would appreciate any help.
Thanks,
Lee