-1

i tries to run this code and i got a http 500 error so i comment out line by line and i saw that the problem arise when i try to assign the values to the variable's i even tried to assign just a simple string and i got error can anyone help me

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 Answers1

1

The line user_image= the url needs to fixed. You left the trailing edge of a comment line in it and you cannot put an address like ../../xxxxx without the whole thing in quotes. So

$user_image = "../../images/missing_user.png";
Forbs
  • 1,256
  • 1
  • 7
  • 9