Hi
Is it possible to execute multiple queries in a single page?
What I want to do this is, once a user is registered, his username, password and type will be inserted in the login table as well as the customerinfo table.
So far this is what I can think of but it doesnt work. Any help would be much appreciated.
<?php
$businessname=$_POST['businessname'];
$businessaddress=$_POST['businessaddress'];
$contactperson=$_POST['contactperson'];
$contactnumber=$_POST['contactnumber'];
$customer_username=$_POST['customer_username'];
$customer_password=$_POST['customer_password'];
$registerdate = date ("Y-m-d");
$type = "user";
$submit = $_POST['submit2'];
if ($submit)
{
//Start connect to DB
$db_name="hp";
$tbl_name="customerinfo";
mysql_connect("localhost", "root", "")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//End connect to DB
//Insert to DB
$sql="INSERT INTO customerinfo VALUES('','$businessname','$businessaddress','$contactperson','$contactnumber','$customer_username','$customer_password','$type','$registerdate')";
$sql2 = "INSERT INTO login VALUES(' ' ,'$customer_username','$customer_password','$type')";
mysql_query($sql, $sql2);
die ("Registration Success!");
}
else
echo "Please fill in the fields!";
?>
The code above gave me this error
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\hp\insertcustomerinfo.php on line 37