开发者

my sql insert query not working

I am inserting userId.It is displaying correct but inserting 0 in spite of actual userId. mycode-

If(! empty($userIDToCheck) || $userIDToCheck != '' )
{
echo $userIDToCheck;  
$sql = "INSERT INTO `pnpdb`.`ruser` (`userid`) VALUES ('$userIDToCheck');";  
mysql_query($sql)开发者_StackOverflow中文版or die(mysql_error());  
echo "Done";  
}

Output : pi203713 Done

But is database it is inserting "0"???


And what datatype is the userid column in ruser?


Have you verified that your variable's value is not zero?

Perhaps there's an assignment mistake further up your code?


Try this:

$sql = "INSERT INTO `pnpdb`.`ruser` (`userid`) VALUES ('".$userIDToCheck."');";  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜