Example:
$uname = $_POST['username']; $sql="SELECT * FROM Administrators WHERE Username LIKE '$uname'"
Note the single quotes around $ uname. When you ping, this is the output -
SELECT * FROM Administrators WHERE Username LIKE 'thierry'
However, if you skip the quote around the $ uname variable in your request, this is what you get -
SELECT * FROM Administrators WHERE Username LIKE thierry
On a MySQL server, the two queries are different. thierry is an input string and is correctly encapsulated in quotation marks, where, as in the second query, this is not the case, which causes an error in MySQL.
Hope this helps and sorry my englis, which is not very good.
Thierry vincent
source share