Search code examples
phpadodboxid

Using PHP variables with ADODB


I am trying to do a SQL query with ADODB, which is used in the OXID framework.

$database = oxDb::getDb();
$sql = 'SELECT oxobjectid FROM oxobject2discount WHERE oxdiscountid = '.$oxdiscountid;
$resultado = $database->execute($sql);

This will always throw and exception error. I know you can use the function Prepare with ADODB to sanitize the statement and get ready to use it. However I am unable to call it in Oxid, it seems.

Anyone knows what to do?


Solution

  • Use " quotes

    $sql = 'SELECT oxobjectid FROM oxobject2discount WHERE oxdiscountid = "'.$oxdiscountid;.'"';