[Solved] Syntacts error in mysql query


The error you are receiving as you’ve shown it is because this line is incorrect:

SELECT * FROM `connections` WHERE 1"

First because it’s ending in an unnecessary double quotation mark. MySQL does not use double quotes but single quotes, and even still the other single quote is not there to match it.

The single quotes are also a problem for community="XYZ", this should read: community = 'XYZ'

Secondly, you don’t have a condition for your where statement, you must be missing something like:

WHERE columnName = 1;

If you were trying to select everything from connections, you can just remove that where clause all together.

EDIT

In addition, MySQL queries are separated by a semi-colon, not a colon, so MySQL will not realize you are trying two different queries.

2

solved Syntacts error in mysql query