Retrieve information from the mysql database and enter it in the php URL


I am trying to fetch a username from the database and so I can fetch the json from the person. The code I currently have gave me an error 500 and probably cause of the $json...

Can someone help me find a solution....

include_once 'dbconnect.php';

    header("Location: index.php");
$res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$json = file_get_contents(' <?php echo $userRow['mouse']; ?> &l=en');
$obj = json_decode($json);
$json = file_get_contents('<?php echo $userRow['mouse']; ?> ');
$objj = json_decode($json);
<!DOCTYPE html>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php echo $obj->name; ?> | CheeseStatz</title>
<link rel="shortcut icon" href="Favicon.ico" />
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.5 -->
  <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="">
  <!-- Ionicons -->
  <link rel="stylesheet" href="">
  <!-- Theme style -->
  <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="../../dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src=""></script>
  <script src=""></script>
<!-- ADD THE CLASS layout-top-nav TO REMOVE THE SIDEBAR. -->
<body class="hold-transition skin-blue layout-top-nav">
<div class="wrapper">

  <header class="main-header">
    <nav class="navbar navbar-static-top">
      <div class="container">
        <div class="navbar-header">
          <a href="index.php" class="navbar-brand"><b>Cheese</b>Statz</a>
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
            <i class="fa fa-bars"></i>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse pull-left" id="navbar-collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="index.php">Home <span class="sr-only">(current)</span></a></li>
            <li><a href="">Transformice</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">Stats<span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="mice.php">Mice Stats</a></li>
                <li><a href="race.php">Racing Stats</a></li>
                <li><a href="boot.php">Bootcamp Stats</a></li>
                <li><a href="surv.php">Survivor Stats</a></li>
                <li class="divider"></li>
                <li><a href="run4.php">Run for Cheese Stats</a></li>
                <li class="divider"></li>
                <li><a href="tribe.php">Your tribe Stats</a></li>
          <form class="navbar-form navbar-left" role="search">
            <div class="form-group">
              <input type="text" class="form-control" id="navbar-search-input" placeholder="Search">
        <!-- /.navbar-collapse -->
        <!-- Navbar Right Menu -->
        <div class="navbar-custom-menu">
          <ul class="nav navbar-nav">
            <!-- Messages: style can be found in dropdown.less-->
            <li class="dropdown messages-menu">

            <!-- User Account Menu -->
            <li class="dropdown user user-menu">
              <!-- Menu Toggle Button -->
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <!-- The user image in the navbar-->
                <img src="" class="user-image" alt="User Image">
                <!-- hidden-xs hides the username on small devices so only the image appears. -->
                <span class="hidden-xs"> <?php echo $obj->name; ?> </span>
              <ul class="dropdown-menu">
                <!-- The user image in the menu -->
                <li class="user-header">
                  <img src="" class="img-circle" alt="User Image">

                    <?php echo $obj->name; ?> - <?php echo $obj->title; ?>
                    <small>Level: <?php echo $objj->level; ?> </small>
                <!-- Menu Body -->
                <li class="user-body">
                  <div class="row">
                    <div class="col-xs-4 text-center">
                      <a href="blog.php">Blog</a>
                    <div class="col-xs-4 text-center">
                      <a href="help.php">Help</a>
                    <div class="col-xs-4 text-center">
                      <a href="log.php">Log</a>
                  <!-- /.row -->
                <!-- Menu Footer-->
                <li class="user-footer">
                  <div class="pull-left">
                    <a href="forum.php" class="btn btn-default btn-flat">Forum</a>
                  <div class="pull-right">
                    <a href="#" class="btn btn-default btn-flat">Sign out</a>
        <!-- /.navbar-custom-menu -->
      <!-- /.container-fluid -->
  <!-- Full Width Column -->
  <div class="content-wrapper">
    <div class="container">
      <!-- Content Header (Page header) -->
      <section class="content-header">
          <small>Transformice Api v.1.0.0</small>
        <ol class="breadcrumb">
          <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
          <li><a href="#"><?php echo $obj->name; ?></a></li>
          <li class="active">Welcome</li>

      <!-- Main content -->
      <section class="content">
  <div class="callout callout-info">
                <h4>Welcome <?php echo $obj->name; ?>!</h4>

          <!-- /.box-body -->
        <!-- /.box -->
      <!-- /.content -->
    <!-- /.container -->
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="container">
      <div class="pull-right hidden-xs">
        <b>Version</b> 1.0.0
      <strong>Copyright &copy; 2015 <a href="">Cheesezwheel</a>.</strong> All rights
    <!-- /.container -->
<!-- ./wrapper -->

<!-- jQuery 2.1.4 -->
<script src="../../plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="../../bootstrap/js/bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="../../plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="../../plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>

  1. I just dont' see why you open and close your php syntax so much
  2. in your link (file_get_contents) you could just use the variables, no need to echo them
  3. check how many result you get from running that query to see if the query is correct
  4. your using ' in your file_get_comments statement, meaning everything after is not run but just text, so it will open n= php echo $userRow['mouse'] instead of the db value of mouse like n=12