0
如何執行執行多個操作的SQL語句?FuelPHP - 如何執行自定義的多行MySQL語句?
當我嘗試執行下面的代碼,我得到一個錯誤Fuel\Core\Database_Exception [ 1064 ]: You have an error in your SQL syntax;
PHP與MySQL內嵌
$sql = "
SET @sql = CONCAT(
'CREATE TEMPORARY TABLE IF NOT EXISTS temp_compiled_properties AS
(SELECT
id,
', @sql, '
FROM properties
WHERE properties.property_id = ?
GROUP BY properties.property_id)');
PREPARE stmt FROM @sql;
EXECUTE stmt USING @property_id;
DEALLOCATE PREPARE stmt;";
DB::query($sql)->execute();