dongyaoxiu6244
2015-09-08 15:25
浏览 45
已采纳

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

I have got this code

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

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

But it does not print any thing or it is not giving any errors

图片转代码服务由CSDN问答提供 功能建议

我有这段代码

  $ 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条回答 默认 最新

  • duanlinzhen7235 2015-09-08 15:34
    已采纳

    Change your query. You were asking fullname only. change it to see the result.

    $dafirstname="SELECT * FROM websiteusers WHERE userName='$usernamer'";
    $differentvariables=mysqli_query($link,$dafirstname);
    $row=mysqli_fetch_array($differentvariables,MYSQLI_ASSOC);
    printf ("%s (%s)
    ", $row["pass"], $row["userID"]);
    if(!mysqli_query($link,$dafirstname)){
      echo mysqli_error($link);     
    }
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题