Hey guys I'm in the middle of connecting my website to my SQL database at the moment i have the following and I need some help if you guys dont mind
config.php
//Mysql Connect | mysql_connect("host","username","password");
//Below example to connect in localhost
$a=mysql_connect("localhost","root","");
//select your database
$b=mysql_select_db("database_name",$a);
submit_form.php
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$username=$_POST['username'];
$confirmusername=$_POST['confirmusername'];
$password=$_POST['password'];
$confirmpassword=$_POST['confirmpassword'];
$email=$_POST['email'];
$confirmemail=$_POST['confirmemail'];
//Database connection
require_once("config.php");
//mysql query to insert value to database
$query=mysql_query("INSERT INTO registration (`firstname`, `lastname`, `username`, `confirmusername`, `password`, `confirmpassword`, `email` ,`confirmemail`) VALUES ('', '$firstname', '$lastname', '$username' , '$confirmusername' , '$password', '$confirmpassword', '$email' , '$confirmemail'
'".$_SERVER['REMOTE_ADDR']."')");
//if value inserted successyully disply success message
if($query)
{
echo '<div style="color:#008000; font-weight:bold;">Registred successfully..!!</div>';
}else
{
//error message
echo '<div style="color:#c24f00; font-weight:bold;">unable to registred !!</div>';
}
I have only ever connected via the old ms access connection so connecting via sql is a whole new thing to me
Can someone just have a look and see where I'm going wrong please, a few weeks ago I put a password onto my PHPmyadmin and it has taken me a week to get back to this stage as xampp decided to bugger up on me