Jump to content

user signup with site error


shortysbest

Recommended Posts

I am building a script for a user to create an account on a site i am working on however It will not post the data to the database, If i echo the data out it is all there and everything, just it will not update on the database, and it doesn't return an error, it says "you have been registered" but the mysql_query is going by.. I cannot figure out why.. it is exactly how i have always done them >.<

 

<?php include('connect.php');
//login start
$signup = $_POST['signup'];
//form data
$fname = ucfirst(strip_tags($_POST['fname']));
$lname = ucfirst(strip_tags($_POST['lname']));
$email = strtolower(strip_tags($_POST['email']));
$password = strtolower(strip_tags($_POST['password']));
$gender = $_POST['gender'];
$fbirthday = $_POST['birthday1'].'/'.$_POST['birthday2'].'/'.$_POST['birthday3'];
$birthday = $fbirthday;

if ($signup)
{


//check for existance
  if ($fname&&$lname&&$password&&$email&&$gender&&$birthday)
  {
    //register user!	
	//encrypt password
	$password = md5($password);
	$queryreg = mysql_query("INSERT INTO users VALUES('','$fname','$lname','$email','$gender','$birthday','')");

		print "<h3>You have been registered.</h3>";

  }
   else
   echo "<h2>Please fill in all fields.</h2>"; 
}
?>

Link to comment
https://forums.phpfreaks.com/topic/207053-user-signup-with-site-error/
Share on other sites

Since you've fixed it ill give u a quick tip:

always echo the full query before executing it, will prevent you from mucking up your database. (Trial your script before you make it live).

 

		$query = "INSERT INTO users VALUES('','$fname','$lname','$email','$gender','$birthday','')";
	exit("<br />QUERY: ".$query."<br />");
	$queryreg = mysql_query($query) or die(mysql_error());

 

or die(mysql_error()); can be very useful especially if display errors is off.

 

-cb-

Archived

This topic is now archived and is closed to further replies.

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