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");

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

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");

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.