php - mysql调用存储过程报错

标签 php mysql

我创建了一个存储过程,但在调用它时出现错误。

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''results0.79123800+1345985910.html')' at line 1

这是我在 php 代码中调用它的方式:

  mysql_query("CALL lastscan($task_id,'$file_name')") or die(mysql_error());

我的数据库中有 sp..

如果它是引用的东西,我如何在不修改存储过程的情况下转义我放入其中的变量?

最佳答案

您的语法不正确,请使用:

mysql_query("CALL lastscan('" .$task_id. "', '" .$file_name. "')") or die(mysql_error());

关于php - mysql调用存储过程报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12130410/

相关文章:

mysql - 我如何获取 SQL 中新插入行的主键值,它应该适用于所有 SQL 库

php - MySQL 'CREATE TABLE' 查询直接工作并通过 PHPMyAdmin 但不是通过 PHP

mysql - 检查多个键是否有重复项时插入的 SQL 代码

php - 指定没有订单的客户

php - 检查字符串长度、最大值和最小值

php - 使用一列中的多个值规范化 MySQL 数据库

MySql - 根据偏好左连接但没有重复项

php - 加密密码列表

php - Laravel 5.1 中使用 eloquent 进行内连接

php - curl 返回 302 找到注册 Telegram 方法