Page 1 of 1

Php select script returns 500 error

Posted: 16 Feb 2017, 21:41
by mlucicom
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">
  <head>
    <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="http://bootstraptaste.com">

    <title>Loveparadyse.com 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: https://bootstrapmade.com/free-bootstrap-coming-soon-template-countdwon/
        Author: BootstrapMade
        Author URL: https://bootstrapmade.com
    ======================================================= -->
  </head>

  <body>
<?php 

     $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">
          <h1>Loveparadyse.com</h1>
          <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>
           
          </form>   
                    <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>
        </div>
        
      </div>
      <div class="row">
        <div class="col-lg-6 col-lg-offset-3">
            <p class="copyright">&copy; Loveparadyse.com - 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: https://bootstrapmade.com/license/
                                Purchase the pro version form: https://bootstrapmade.com/buy/?theme=WeBuild
                            -->
                            <a href="https://bootstrapmade.com/">Free Bootstrap Themes</a> by <a href="https://bootstrapmade.com/">BootstrapMade</a>
                        </div>
        </div>
      </div>    
    </div>
  </div>
    <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
  <script src="assets/js/jquery.countdown.min.js"></script>
  
    
</body>
</html>
Have you any ideea why this don't work?

Php select script returns 500 error

Posted: 17 Feb 2017, 10:54
by Admin
Hello,
That problem is not from that script, generally the 500 error is from server problems or from some code in .htaccess file.