SQLSTATE [HY000]:一般错误

时间:2017-04-19 10:10:31

标签: php sql yii error-handling yii2

当我尝试获取数据库表的备份时,我遇到了上述错误问题。请检查

$table_name = "back_up_manager";
$backup_file  = "/var/www/html/solaris_dev/uploads/back_up_manager".date('F h:i:s').".csv";
$sql = "SELECT * INTO OUTFILE '$backup_file' FROM $table_name";
$command = Yii::$app->db->createCommand($sql)->queryAll();

1 个答案:

答案 0 :(得分:0)

张这部分代码

$sql = "SELECT * INTO OUTFILE '" . $backup_file. "' FROM " .$table_name;

在您的示例中,$sql变量包含无效的文件路径。