我有这个功能:
function myFunction(string $name) {
$db = mysql_connect("localhost", "root", "");
mysql_select_db(...);
$insertplayer="INSERT INTO `...`(....)
VALUES (......')";
if (!mysql_query($insertplayer,$db))
{
die('Error: ' . mysql_error());
}
$id = mysql_insert_id();
echo 'done for player N°'.$id;
mysql_close($db);
}
和我使用的形式:
但是当我这样做时,我有这个错误:
Catchable fatal error: Argument 1 passed to myFunction() must be an instance of string, string given, called in C:.... on line 23 and defined in C:...
我有int问题的这个错误.我怎么解决呢?
在PHP中尝试调用myFunction函数时遇到错误,提示Argument 1必须是string类型,但实际传递的是int。解决这个问题的方法在于确保函数参数正确转换为字符串。我们将探讨问题原因并提供修复步骤。

250

被折叠的 条评论
为什么被折叠?



