0

I have cretaed a login page in php got the database and connection how ever when i register i get an error Error: User not added to database. this code is in my register.php file
can anyone help
thanks

//
Make sure query inserted user successfully
 if ( !mysql_insert_id() )
  {
  die("Error: User not added to database.");
  }
 else
  {
  // Redirect to thank you page.
  Header("Location: register.php?op=thanks");

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by danny5514
0

Presumably, the previous insert failed. Your problem is likely with the insert itself not with this piece of code.

0

yes,

check your inserted id once..

//
Make sure query inserted user successfully
echo mysql_insert_id();
 if ( mysql_insert_id()!=0)
  {
  die("Error: User not added to database.");
  }
 else
  {
  // Redirect to thank you page.
  Header("Location: register.php?op=thanks");
0

chrishea the was a problem at first when i went to the registration page it did say cant connect to database however i fixed that problem


Shanti Chepuru i will try see if it works

thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.