使用mysqli插入时警告

问题描述 投票:-4回答:1

我想使用MySQL在数据库中插入一行。但这没用。

当我使用mysqli时,它给了我这个

警告:mysqli_query()期望参数1为mysqli,第34行的*** / misc / php / process.php中给出的字符串

mysqli_query("INSERT INTO messages (from,to,time,msg) VALUES ('$from','$to','$time','$msg')",$conn);

这是什么意思,我可以解决它吗?

php mysqli
1个回答
1
投票

您的mysqli_query错误,因为您的链接和查询项被翻转。以下应解决该问题。

mysqli_query($conn, "INSERT INTO messages (`from`,`to`,`time`,`msg`) VALUES ('$from','$to','$time','$msg')");
© www.soinside.com 2019 - 2024. All rights reserved.