So I want to write the following query in PHP
using PHP
but I am wasting a ton of time trying to figure out something that should be simple.
Query in SQL
SELECT *
FROM `table_name`
WHERE `column1` = 0560
Now it has to be exactly that way, the values can't have ' '
, or " "
, or even back ticks around them. I tried it with those around the values and it just keeps failing even in SQL
if its not exactly like the above.
Now I have tried the following, but none of which are successful and it's annoying me to no end
$a_query = "SELECT * FROM `".$table_name."` WHERE `".$column_name."` = `".$store_num."`";
$a_query = "SELECT * FROM `table_name` WHERE `column1` = `0560`";
I know I've tried a few other variations I just can't recall them right now. I've been at this for a while this evening.
Anyways I get this error every time
SQLSTATE[42S22]: Column not found: 1054 Unknown column '0560' in 'where clause'
Thanks for the help, I realize I'm probably missing something simple, my eyes are just fried