- 3,341
Ok, Seeing as this place could use some more activity, i need some help concerning MySQL and nickname registering.
My question is how do i prevent the same nickname from being regeistered twice.
i need to know this as i am tring to make a simple user registration system (i hope to eveolve it into a bbs in time), but a name can be registerd twice
heres my code :
register.html
reg.php
(also can you show me how to use something better than $_GET )
My question is how do i prevent the same nickname from being regeistered twice.
i need to know this as i am tring to make a simple user registration system (i hope to eveolve it into a bbs in time), but a name can be registerd twice
heres my code :
register.html
Code:
<form action="reg.php">
Name: <input type="text" name="nick_name" maxlength="25"><br />
Password :<input type="password" name="nick_pass" maxlength="25"><br />
<button type="submit" name="submit">Submit</button>
</form>
reg.php
PHP:
<?php
$user = $_GET['nick_name'];
$pass = $_GET['nick_pass'];
mysql_connect("localhost","root","xxzzyy");
mysql_select_db('bbs_test');
mysql_query('INSERT INTO `users` ( `name` , `pass` ) VALUES (\'' . $user . '\', PASSWORD( \'' . $pass . '\' ) )');
echo $user . ' Sucessfully EnteredInto DB';
?>
(also can you show me how to use something better than $_GET )