dqyy38265 2017-10-03 13:40
浏览 39
已采纳

会话名称未显示

Am trying to show the value of the $login_session in my welcome page but it doesn't show. Any help on that

Welcome.html:

<?php
   include("session.php");
?>
<html>
      <h1>Welcome <?php echo $login_session; ?></h1> 
</html>

Session.php

:
<?php  
  include ("db_connection.php");    session_start();
    $user_check = $_SESSION['login_user'];
          $ses_sql = mysqli_query($conn,"select First_name from User where Email = '$user_check' ");
        $row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
        $login_session = $row['First_name']; ?>
  • 写回答

3条回答 默认 最新

  • duanmao1872 2017-10-03 13:47
    关注

    welcome.html ? try executing it as .php or You can't execute php in html file, unless you instruct Apache to treat .html files as PHP

    to do this , Create a .htaccess file at the root of your website and add this line:

    [Apache2 @ Ubuntu/Debian: use this directive]
    
    AddType application/x-httpd-php .html .htm
    

    If your are running PHP as CGI (probably not the case), you should write instead:

    AddHandler application/x-httpd-php .html .htm
    

    Also try with localhost / server !

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

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分