mysqli插入问题 [英] mysqli insert problems

查看:51
本文介绍了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 :)

推荐答案

链接值女巫用作mysqli_connect出于安全原因任何帮助将不胜感激我有问题的部分是



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(
result) == 0) { echo("create"); mysqli_query(


link,INSERT INTO website(`uuid`,`name`,`pass`,`email`)VALUES(
link,"INSERT INTO website (`uuid`, `name`, `pass`, `email`) VALUES (


这篇关于mysqli插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆