doutuo3935 2014-04-06 14:36
浏览 48
已采纳

获取行并在echo mysqli中显示它们

im trying to get the rows from database with mysqli prepare statments and display them in echo like <?php echo $username; ?> but don't know how to get them , wasted 4 hours no success , help would be greate

php

 <?php
 include("secure/functions.php");
 session_start(); 
$stmt = $mysqli->prepare("SELECT * FROM members WHERE username = ?"); 
    $stmt->bind_param('s', $_SESSION['username']); // Bind "$username" to parameter.
    $stmt->execute(); // Execute the prepared query.
    $stmt->store_result();
     if($stmt->num_rows == 1) {
     $stmt->bind_result($id,$username); // get variables from result.
       $stmt->fetch();
}
?>
  • 写回答

2条回答 默认 最新

  • doujiu3095 2014-04-06 14:56
    关注

    You initially used $session_start(); where it should be session_start(); no dollar sign.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试