im using :s,:p:i which makes sense, but causes problems when using str_replace and there are params that start with the same letter.
best to use descriptive names, and bind params by name nut number:
should look like this
$sSQL = "SELECT :m_col,:s_col,:i_col,:p_col from ':table' WHERE :m_col=:name AND :i_col like :pattern order by RANDOM() limit 1";
$sSQL = str_replace(":table", self::MANIFEST_TABLE, $sSQL);
$sSQL = str_replace(":m_col", self::COL_MISSION, $sSQL);
$sSQL = str_replace(":s_col", self::COL_SOL, $sSQL);
$sSQL = str_replace(":i_col", self::COL_INSTR, $sSQL);
$sSQL = str_replace(":p_col", self::COL_PRODUCT, $sSQL);
$oSqlDB = self::$oSQLDB;
$oStmt = $oSqlDB->prepare($sSQL);
$oStmt->bindValue(":name", cSpaceMissions::CURIOSITY);
$oStmt->bindValue(":pattern", "MAST_%");
$sSQL = $oStmt->getSQL(true);
cDebug::extra_debug("SQL: $sSQL");
im using :s,:p:i which makes sense, but causes problems when using str_replace and there are params that start with the same letter. best to use descriptive names, and bind params by name nut number:
should look like this