不能将值赋给变量

时间:2016-08-28 14:36:41

标签: php

我试图运行此代码,我得到一个http 500错误所以我逐行注释,我看到问题出现当我尝试将值分配给变量我甚至试图只分配一个简单的字符串和我有错误,任何人都可以帮助我

require 'connect_to_database.php';

    $user_id = $_REQUEST['user_id'];

    $select_query = "SELECT * FROM users WHERE user_id = " . $user_id;

    $result = mysql_query($select_query);

    if ($result)  {
    $row = mysql_fetch_array($result);
    $first_name = hello;
    $last_name = $row['last_name'];
    $bio = $row['bio'];
    $email = $row['email'];
    $faebook_url = $row['facebook_url'];
    $twitter_url = $row['twitter_handle'];
    $user_image = "../../images/missing_user.png;"

    } else {
    die("Error locating user with ID {$user_id}");
    } 
    ?>

    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <title></title>
    <link href="../../css/phpMM.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div id="header"><h1>The Missing Manual</h1></div>
    <div id="example">User profile</div>
    <div id="content">
    <div class="user_profile">
    <h1><?php echo "{$first_name} {$last_name}"; ?></h1>
    <p><?php  echo $bio; ?></p>
    <p class="contact_info">Get in touch  <?php echo $first_name; ?>:</p> 
           <ul>
    <li>...by emailing them at <a href="<?php echo $email; ?>">  
    <?php echo $email; ?></a></li>
    <li>...by <a href="<?php echo $faebook_url; ?>">
     checking them out on  facebook</a></li>
              <li>...by <a href="<?php echo $twitter_url; ?>">
     following them on twitter</a></li>
           </ul>
       </div>
      </div>
      <div id="footer"></div>
     </body>
    </html>

1 个答案:

答案 0 :(得分:1)

网址user_image=需要修复。你在其中留下了注释行的后端,你不能在没有引号的情况下放置像../../xxxxx这样的地址。所以

$user_image = "../../images/missing_user.png";