无法使用mysqli从数据库获取数据

时间:2015-09-08 15:25:10

标签: php sql mysqli

我有这段代码

$dafirstname = "SELECT fullname FROM websiteusers WHERE userName='$usernamer'";
$differentvariables = mysqli_query($link, $dafirstname);
$row = mysqli_fetch_array($differentvariables, MYSQLI_ASSOC);
printf("%s (%s)\n", $row["pass"], $row["userID"]);

if(!mysqli_query($link,$dafirstname)){
  echo mysqli_error($link);     
}

但它没有打印任何东西或它没有给出任何错误

1 个答案:

答案 0 :(得分:0)

更改您的查询。你只问全名。改变它以查看结果。

$dafirstname="SELECT * FROM websiteusers WHERE userName='$usernamer'";
$differentvariables=mysqli_query($link,$dafirstname);
$row=mysqli_fetch_array($differentvariables,MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["pass"], $row["userID"]);
if(!mysqli_query($link,$dafirstname)){
  echo mysqli_error($link);     
}