I am trying to make a postgresql select query work with php, but can't get past the syntax.
I have a variable and a query that returns the surname of any match.
$name = 'Smith';
$query = 'SELECT surname FROM emploee WHERE name= '.$name.';';
$a = pg_query(connect(),$query );
while($row = pg_fetch_array($a)){ echo "Match"; }
For those who wonder why do I have to declare Smith as a variable, $name is not always equals to Smith. The value of $name is taken correctly from another query. However, this is not working. I read in an article that I should use pg_query_params() but couldn't get that to work neither.
Your help would be highly appreciated