Thanks Sara, buttt.. a problem?
<?
if(!isset($username) || !isset($passwd) || !isset($email))
{
echo "<b>Please fill out all fields</b>";
exit; // but really, I need to refresh the form
}
$dbconn = mysql_pconnect("localhost","l3lade","****"); //establish connection w/db
$result = mysql_select_db("Hazardnet", $dbconn); //establish connection w/db
$sql = "SELECT count(*) as cnter FROM Hazardnet_users WHERE username='$username'"; //query to return all results where the username equals the username they signed up with
$result = mysql_query($sql) or die(mysql_error()); //send the query to the database
if($result != false)
{ //make sure there were no errors;database is running
$data = mysql_fetch_assoc( $result );
if($data['cnter'] == 0)
{
// this was almost certainly falling over with bad syntax added an additional )
$sql = ("INSERT INTO Hazardnet_users (username, passwd, email) VALUES ('$username', '$passwd', '$email')";
echo "$sql<br>";
mysql_query( $sql );
}
else
{
echo "<b>Username exists</b> ";
}
else
{
echo "<b>There was a problem!</b> " . mysql_error() . "<br>";
}
?>
you forgot (? i think) a ")".. on this line.
// this was almost certainly falling over with bad syntax added an additional )
$sql = ("INSERT INTO Hazardnet_users (username, passwd, email) VALUES ('$username', '$passwd', '$email')";
when i put it there. it gives me an error, when i try to register:
Parse error: parse error, unexpected T_ELSE in C:\Documents and Settings\Mark\Desktop\My Web Sites\Hazardnet\check.php on line 27