Answer the question
In order to leave comments, you need to log in
Why is a new line not being added in MySql PHP?
There was a need to write a small server where all the synchronization will take place, but when writing the registration, I already stumbled upon a problem, the fact is that when the table is empty, the entry is added, but as the table is occupied by one value, you simply cannot add one more to get two and more values, how to solve the problem?
Registration script
<?PHP
$name = $_POST['name'];
$pass = $_POST['password'];
$email = $_POST['email'];
require_once('database.php');
$check = mysql_query("SELECT * FROM users WHERE `name`='".$name."'");
$numrows = mysql_num_rows($check);
if ($numrows == 0)
{
$pass = md5($pass);
$ins = mysql_query("INSERT INTO users ( `name` , `password` , `email` ) VALUES ( '".$name."' , '".$pass."' , '".$email."') ; ");
if ($ins)
die ("Succesfully Created User!");
else
die ("Error: " . mysql_error());
}
else
{
die("User allready exists!");
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question