Php select script returns 500 error

Discuss coding issues, and scripts related to PHP and MySQL.
Posts: 37

Php select script returns 500 error

Hi Admin!
I have a php code that select values from database but this return 500 error when i execute

Code: Select all

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Free coming soon template with jQuery countdown">
    <meta name="author" content="">

    <title> Link referinta</title>

    <!-- Bootstrap -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
  <link href="assets/css/bootstrap-theme.css" rel="stylesheet">
  <link href="assets/css/font-awesome.css" rel="stylesheet">

    <!-- siimple style -->
    <link href="assets/css/style.css" rel="stylesheet">
    <!-- =======================================================
        Theme Name: WeBuild
        Theme URL:
        Author: BootstrapMade
        Author URL:
    ======================================================= -->


     $servername = "localhost";

          $username = "website_retea";

          $password = "";

          $dbname = "website_retea";

          // Create connection

           $conn = new mysqli($servername, $username, $password, $dbname);

          // Check connection

          if ($conn->connect_error) {

              die("Connection failed: " . $conn->connect_error);


     $q=$conn->query("SELECT DISTINCT username, email FROM users ORDER BY username");
 foreach($q as $cat){
    echo '<li id="'.$cat['username'].'" class="files">';  
    echo '<a href="'.$cat['username'].'">'.$cat['email'].'</a>'; 
    echo '<ul class="sub-menu">';
    $linkq=$conn->query("SELECT * FROM users WHERE ref='" . $cat['username'] . "'"); 
    foreach($linkq as $link){
       echo '<li><a href="#">'.$link['username'].'</a></li>';
    echo '</ul></li>';
  <div id="wrapper">
    <div class="container">
      <div class="row">
        <div class="col-md-12">
          <h2 class="subtitle">We develop a complex referral system.Copy your referral link and share with your friends</h2>
          <div id="countdown"></div>
          <form class="form-inline signup" role="form">
            <div class="form-group">

             <p style="color:#fff;">You invited :  persons
                    <div class="social">
                        <a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a>
                         <a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a>
                         <a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a>
                         <a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
      <div class="row">
        <div class="col-lg-6 col-lg-offset-3">
            <p class="copyright">&copy; - All Rights Reserved</p>
                        <div class="credits">
                                All the links in the footer should remain intact. 
                                You can delete the links only if you purchased the pro version.
                                Licensing information:
                                Purchase the pro version form:
                            <a href="">Free Bootstrap Themes</a> by <a href="">BootstrapMade</a>
    <script src=""></script>
    <script src="assets/js/bootstrap.min.js"></script>
  <script src="assets/js/jquery.countdown.min.js"></script>
Have you any ideea why this don't work?

That problem is not from that script, generally the 500 error is from server problems or from some code in .htaccess file.

Similar Topics