It is my first time setting up databases in MySQL and using them so I would appreciate any help as my hours of searching online have not helped me with this error.
I basically have one tables in my DB.
Airport:
Title- 3 Char & PublicKey
AirportName- 100 Char & Not null
I have coded a webpage in php that should allow me to delete my entries depending on which one I select.
In short this is my php:
$result = mysql_query("DELETE FROM airport WHERE Title=$Title")
or die(mysql_error());
It gives me this error:
Unknown column 'ABC' in 'where clause'
If I run this in phpmyadmin:
DELETE FROM airport WHERE Title=ABC
It gives me this error:
Unknown column 'ABC' in 'where clause'
If I run this in phpmyadmin it works:
DELETE FROM airport WHERE Title="ABC"
But if I add quotes in my php code the page dies. Any pointers?
since title field of your db is varchar, better encode $title with single quote and use mysql_real_escape_string too for cleaning unsafe db chars.
like: