0

I am trying to use two inner join as foreign key. Actually, I have transaction table and this table will be inner join customer and product. When I make SQL, it occurs error, 'You have an error in your SQL syntax'. Could you check my SQL syntax for php mysql? I cannot find error on my eye. Please help me, and thanks.

$sql = mysql_query("SELECT T.transactionId, P.product_name, P.product_price, P.stock, C.firstName, C.address, C.postCode " + 
                           "FROM transaction T " + "INNER JOIN customer C ON T.customerId = C.customerId " + 
                           "INNER JOIN product P ON T.productId = P.productId");

1 Answer 1

1

It looks like you are using a plus sign instead of a period to concatenate your sql query.

Sign up to request clarification or add additional context in comments.

1 Comment

When I delete + sign, then it OK. Can I have one more question? When I delete and want to show information, error comes, 'undefined index' about all column without transactionId. Is it any wrong syntax with INNER JOIN?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.