本文介绍了mysqli插入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在将数据插入到我的mysql数据库时遇到了一些麻烦我已经在底部附加了完整的脚本但是我遗漏了$ link值,因为出于安全原因而使用mysqli_connect任何帮助都是感谢我遇到问题的部分是
Hi, i'm having a little bit of trouble inserting data into my mysql database i have attached the full script at the bottom but i have left out the $link value witch is used as mysqli_connect for security reasons any help would be appreciated the section that i'm having problems with is
else if (mysqli_num_rows($result) == 0)
{
echo("create");
mysqli_query($link,"INSERT INTO website (`uuid`, `name`, `pass`, `email`) VALUES ($uuid, $user, 556, $email)") or mysqli_error($link);
}
i获取消息创建,但不会将数据插入表格。
完整剧本:
i get the message create but it don't insert the data into the table.
full script:
$uuid = $_REQUEST['uuid'];
$user = $_REQUEST['user'];
$email = $_REQUEST['email'];
//mysqli_query($link, "SELECT * FROM website WHERE user = '$usr'");
$result = mysqli_query($link, "SELECT * FROM website WHERE uuid = '$uuid'");
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
if($uuid != $row["uuid"])
{
echo("Can not create 2 accounts!");
//user already registered
}
}
}
else if (mysqli_num_rows($result) == 0)
{
echo("create");
mysqli_query($link,"INSERT INTO website (`uuid`, `name`, `pass`, `email`) VALUES ($uuid, $user, 556, $email)") or mysqli_error($link);
}
提前谢谢:)
thank you in advance :)
推荐答案
else if (mysqli_num_rows(
这篇关于mysqli插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!