This in PHP3:
I have a class 'sm' that wants to call a method in another class 'db'.
Class sm has a class variable $db that holds an instance of db.
$result = $this->db->Query("SELECT * FROM tablename WHERE somefield = 'xyz'");
This does not work:
$sql = "SELECT * FROM tablename WHERE somefield = 'xyz'";
$result = $this->db->Query($sql);
The second version causes PostGres to issue a parsing error. I've cut and pasted the SQL back and forth... it's identical in both cases.
Printing the $sql arg in the receiving method shows exactly the same text either way.
Setting a local variable in the receiving method to the passsed $sql, and then passing the local to PostGres doesn't help.
Passing $sql by reference doesn't help.
I'm baffled. Any ideas?