Welcome Guest, Not a member yet? Register   Sign In
Variable in a SQL Query
#1

[eluser]invision[/eluser]
Hi,

I'm using the following code to select data from my database:
Code:
$this->db->query("SELECT entry.id, city.*, country.* FROM entry, city WHERE  city.country = {$country}");

This query outputs as:
Quote:SELECT entry.id, city.*, country.* FROM entry, city WHERE city.country = gbr
but I need it as:
Quote:SELECT entry.id, city.*, country.* FROM entry, city WHERE city.country = 'gbr'


How do I change the query to treat gbr[b] as [b]'gbr'(a string)?


Messages In This Thread
Variable in a SQL Query - by El Forum - 02-10-2011, 02:07 PM
Variable in a SQL Query - by El Forum - 02-10-2011, 02:38 PM
Variable in a SQL Query - by El Forum - 02-10-2011, 03:03 PM
Variable in a SQL Query - by El Forum - 02-10-2011, 03:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB