Jump to content

I can't find where I messed up


WilliamNova

Recommended Posts

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
Share on other sites

Line 42, $artistname has a problem (no matching end quote)

 

$register = mysql_query("INSERT INTO artists VALUES('','$artistname,'$location','$genre','$email','$password','','','no')");

Edited by xenLiam
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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