WilliamNova Posted August 17, 2013 Share Posted August 17, 2013 So I have a registration form for 'users' and another registration form for 'artists' and only one works, being the 'users' one. However, all I did for 'artists' was copy the same code from 'users' and then change what needed to be changed so it would insert into the 'artists' table and not the 'users' table. I just can't find where I messed up while doing this. $error = ""; if (@$_POST['register']) { $artistname = strip_tags($_POST['artistname']); $location = strip_tags($_POST['location']); $genre = strip_tags($_POST['genre']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $password2 = strip_tags($_POST['password2']); if ($artistname == "") { $error = "Artist Name cannot be left empty."; } else if ($location == "") { $error = "Location cannot be left empty."; } else if ($genre == "") { $error = "Genre cannot be left empty."; } else if ($email == "") { $error = "Email cannot be left empty."; } else if ($password == "") { $error = "Password cannot be left empty."; } else if ($password2 == "") { $error = "Repeat Password cannot be left empty."; } $check_email = mysql_query("SELECT email FROM artists WHERE email='$email'"); $numrows_email = mysql_num_rows($check_email); if ($numrows_email != 0) { $error = 'That email has already been registered.'; } else { //Register the user $register = mysql_query("INSERT INTO artists VALUES('','$artistname,'$location','$genre','$email','$password','','','no')"); die('<p style="padding: 10px;" /><b>Registered successfully!</b><br /><br /> <a href="artistlogin.php">Login now ></a></p>'); } } ?> <form action='artistsignup.php' method='POST' style='padding:10px;'> Artist Name:<br /> <input type='text' name='artistname' value='' onclick='value=""'/><p /> Location:<br /> <input type='text' name='location' value='' onclick='value=""'/><p /> Genre:<br /> <input type='text' name='genre' value='' onclick='value=""'/><p /> Email:<br /> <input type='text' name='email' value='' onclick='value=""'/><p /> Password:<br /> <input type='password' name='password' value='' onclick='value=""'/><p /> Repeat Password:<br /> <input type='password' name='password2' value='' onclick='value=""'/><p /> <input type='submit' name='register' value='Register' /> <?php echo $error; ?> </form> Link to comment https://forums.phpfreaks.com/topic/281288-i-cant-find-where-i-messed-up/ Share on other sites More sharing options...
WilliamNova Posted August 17, 2013 Author Share Posted August 17, 2013 And for what it matters I have tried using die(mysql_error()); which gives me nothing and I always receive "Registered Successfully!" Link to comment https://forums.phpfreaks.com/topic/281288-i-cant-find-where-i-messed-up/#findComment-1445570 Share on other sites More sharing options...
xenLiam Posted August 17, 2013 Share Posted August 17, 2013 Does it give you a PHP error, or does it not simply insert the values into the table? Link to comment https://forums.phpfreaks.com/topic/281288-i-cant-find-where-i-messed-up/#findComment-1445571 Share on other sites More sharing options...
WilliamNova Posted August 18, 2013 Author Share Posted August 18, 2013 There's no PHP errors given. It's simply not inserting into the table. Which is why I believe I messed up somewhere, either accidentally added a character into something or removed one while I was editing the code. Link to comment https://forums.phpfreaks.com/topic/281288-i-cant-find-where-i-messed-up/#findComment-1445577 Share on other sites More sharing options...
xenLiam Posted August 18, 2013 Share Posted August 18, 2013 Line 42, $artistname has a problem (no matching end quote) $register = mysql_query("INSERT INTO artists VALUES('','$artistname,'$location','$genre','$email','$password','','','no')"); Link to comment https://forums.phpfreaks.com/topic/281288-i-cant-find-where-i-messed-up/#findComment-1445604 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.