mysql 过程整数到字符串错误

mysql procedure integer to string error

我在 mysql 中有一个 INSERT 查询。

我使用 procedure 我的查询是这样的:(我使用 codeigniter 框架)

$query = $this->db->query('call Set_Shoe_SP(1, NULL, ?)' , array($type) );

$type是一个整数,但是想插入为string,出现了这个错误:

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 '' at line 1
call Set_Shoe_SP(1, NULL, '20',
Filename: C:\xampp\htdocs\royalshop\system\database\DB_driver.php
Line Number: 330

我该怎么办?谢谢

如果是数据类型错误,那么就像这样将数据类型转换为字符串一样简单

Array((string)$type)

不确定这是不是你的错误

这样试试:

$query = $this->db->query('call Set_Shoe_SP(1, NULL, ' . $type . ')' , FALSE );