PHP script to insert user into mysql database

If you are planning to design a simple dynamic website, the best technology combination to start with is MySQL database at the backend, PHP as front end scripting language. In any website, user interaction is important. Equally important is the user detail. Here is a simple PHP script that establishes connection with backend MySQL database and inserts username, email address into it. The database is installed in localmachine and hence servername is localhost. Change it to your appropriate Server IP in your test. This script should be included between PHP starting tag and ending tag $user_name = $_GET["name"]; $ email = $_GET["email"]; print "You have logged in as : $user_name n"; print "Your email Address is : $email n"; /* Connect to the MySQL database using functions. We demonstrate this with server - localhost; username - root; password - pass */ mysql_connect("localhost","root","pass"); $result = mysql_query("insert into phpdemo.usertable(name,email) values ('$user_name','$email')"); if ($result) {print <<< EOF Thanks for registering your username and email aaddress with us EOF; } else { print "Please Enter Appropriate Values...We apologizze if there is some system problem...Report us via email if you get the same problem"; } mysql_close(); This script assumes that phpdemo database has been already created in the mysql datbase installed in localhost. usertable is the table that exists in phpdemo database. This script can be saved as say details.php. Now comes the main index.html script in which we have a input form through which we obtain the details through T_GET. Create a simple html script with form to get this done