Closed mridah closed 3 years ago
@mridah I'm running into the same problem. Did you already find any solution?
@sebastianroming I was able to get it working but not with the query builder.
I had to use raw queries like the following:
$db = new \Slim\PDO\Database($db, $username, $password);
$stmt = $db->query('select * from emp;');
$stmt->execute();
$data = $stmt->fetchAll();
Hi if you don't want third Clause\Conditional parameter beeing evaluated as a string to quote, you have to use
Clause\Raw
this allow you to specify a literal, that wil be considered AS-IS during statement construction. So your query section became:
->join(new Clause\Join('company', new Clause\Conditional('users.company_id', '=', new Clause\Raw('company.id')), 'INNER'))
(assuming the rest of query is correct); this is quite verbose, i suggest to use 'use FaaPz\PDO\Clause\Raw, Conditional' in front of your php script.
Documentation examples in GitHub are also wrong. Askinq developer to correct them, please.
Regards
Updated the JOIN documentation to show Raw clause.
I'm trying to work with joins but it's not giving the expected output.
This is the query I'm trying to achieve :
This query works fine but when I try to implement it in PDO, the
company_name
value is alwaysNULL
This is my code:
The response of
__toString() is
:And, the response of getValues is:
This is happening most probably because PDO is evaluating statement
as
instead of
Am I doing anything wrong here @kwhat @FaaPz @delef ?