Is it possible to get the query that it's being tried to be executed on PHP?
Here is the code i'm trying:
public static function executeInsertQuery($sqlQuery)
{
$dbTable = mysql_query($sqlQuery, self::$_dbLink);
if($dbTable === false){
Models_Error::throwException("Connection to table failed.", 'database');
}
return null;
}
How can I validate that to be always an Insert into query?
Don't rely on being passed a query.
In my current project, if I want to insert something, it looks like this:
DB::insert("tablename",array(
"column" => "value",
"col2" => "val2",
"foo" => "bar"
));
This is then translated into a proper query (using PDO in this case, but that doesn't matter here)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.