[英]Mysql insert - don't insert
I'm new and have a question. 我是新手,有一个问题。
I think you know it , but I 'm new. 我想您知道,但我是新手。 So I hope you can see what here wrong is and why!
因此,我希望您能看到问题出在哪里以及为什么!
And this is my Code 这是我的代码
<?php
//Verbindung zur Datenbank herstellen
mysql_connect("****:3306", "****","*****!") or die ("Verbindung nicht möglich");
mysql_select_db("***") or die ("Datenbank existiert nicht");
$select = mysql_query("SELECT * FROM tbl_users WHERE userID = " . intval($row['userID']));
while ($row = mysql_fetch_array($select))
{
$row['userID'];
$row['userName'];
$select = mysql_query("INSERT INTO spielautomat_gewinn (userID, userName, gewinn) VALUES ('{$row['userID']}', ''{$row['userName']}', '+')");
}
?>
So, first select then insert. 因此,首先选择然后插入。 But Insert don't work, but it may also be due to select, but insert don't work.
但是插入不起作用,但这也可能是由于选择导致的,但是插入不起作用。 And so I can not check select.
所以我不能检查选择。 And there are not Errors, the Website work but insert not.
并且没有错误,网站可以正常工作,但不能插入。
I hope you can help me. 我希望你能帮助我。 Thanks
谢谢
It's Okay that you are new :) every one was new. 没关系,您是新手:)每个人都是新手。 Step the million strats with one.
一步步走百万级。 This is the problem: *) You did not save the $row['userID'] and $row['userName'] to variables Solution:
这是问题所在:*)您没有将$ row ['userID']和$ row ['userName']保存到变量中解决方法:
<?php
//Verbindung zur Datenbank herstellen
mysql_connect("localhost:3306", "kevin","madarmadar22!") or die ("Verbindung nicht möglich");
mysql_select_db("mohammada_kevin") or die ("Datenbank existiert nicht");
$select = mysql_query("SELECT * FROM tbl_users WHERE userID = " . intval($row['userID']));
while ($row = mysql_fetch_assoc($select))
{
$uid = $row['userID'];
$userName = $row['userName'];
$select = mysql_query("INSERT INTO spielautomat_gewinn (userID, userName, gewinn) VALUES ('$uid', '$userName', '+')");
}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.