Link to home
Start Free TrialLog in
Avatar of MrFahad
MrFahad

asked on

2 quires at same time

Hello,

i want to do run to quires at the same time here is the code:

here is the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO transaction ( PropertyName, CustomerName, dateOfTransacti' at line 6
$query = "INSERT INTO customers (
									  PropertyName, CustomerName, CustomerAddress, CustomerAge, CustomerGender, CustomerNumber, CustomerNationality, dateOfTransaction, description
									  )VALUES (
									  '{$PropertyName}', '{$CustomerName}', '{$CustomerAddress}', {$CustomerAge}, '{$CustomerGender}', {$CustomerNumber}, '{$CustomerNationality}', '{$dateOfTransaction}', '{$description}'
									  )
			INSERT INTO transaction (
									  PropertyName, CustomerName, dateOfTransaction
									  )VALUES (
									  '{$PropertyName}', '{$CustomerName}', '{$dateOfTransaction}'
									  )";

Open in new window

SOLUTION
Avatar of DavidSingleton
DavidSingleton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Loganathan Natarajan
Loganathan Natarajan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
See below

$query = "INSERT INTO customers (
									  PropertyName, CustomerName, CustomerAddress, CustomerAge, CustomerGender, CustomerNumber, CustomerNationality, dateOfTransaction, description
									  )VALUES (
									  '{$PropertyName}', '{$CustomerName}', '{$CustomerAddress}', {$CustomerAge}, '{$CustomerGender}', {$CustomerNumber}, '{$CustomerNationality}', '{$dateOfTransaction}', '{$description}'), (
									  '{$PropertyName}', '{$CustomerName}', '{$dateOfTransaction}'
									  )";

Open in new window

Oops my mistake, my above code works with same table structure.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial