I simply began with PHP and my SQL databases, I've learned how you can create databases, and make register forms that keep info on the databases, but I don't understand how to keep people from having the ability to register having a user title that was already taken, and I'm not sure how you can allow customers to obtain their own profile page on my small website. Are you aware how? I'm using XAMPP to check my databases and PHP code on my small local server, in the event that help by any means. Here's my PHP code:
<?php $disadvantage=mysql_connect("localhost", "root", "" ) if (!$disadvantage) $username=$_Publish['username'] $password=$_Publish['password'] $email=$_Publish['email'] mysql_choose_db("test", $disadvantage) mysql_query("Place INTO customers (id, username, password, email) VALUES (NULL,'$username', MD5('$password'), '$email')") if (my_query) echo "Account Effectively Produced" else echo "Sorry Couldn't Create Account !" mysql_close($disadvantage) ?>
For the first problem:
Whenever a user attempts to register, before creating their account, check to make sure their preferred username has not recently been taken.
To make sure no duplicate usernames, result in the
username column unique
PLEASE make certain you educate yourself on SQL injections before ongoing. It is good to obtain good MySQL habits early!
You will need to alter the following SQL query to suit your current database structure, however, you should begin to see the pattern of what's happening -
$getSQL = "Choose * FROM customers WHERE username = '$username'" $getResult = mysql_query($getSQL) if(mysql_num_rows($getResult) > ) else
So far as an account page, produce a viewprofile.php file that can take anyone's ID, and also the following code should enable you to get pointed in the right direction.
$getSQL = "Choose * FROM customers WHERE id = '$id'" $getResult = mysql_query($getSQL) if(mysql_num_rows($getResult) > ) seen is available while($gR = mysql_fetch_array($getResult)) else seen does not exist