title: How to fix my code when mysql query dies, but query works in dbms?
body: <p>I'm trying to setting up a website for a school procjet, where I've to join to tables to get a result. When I insert the code in phpMyAdmin in runs and gives be the desired result, but in the php file it dies. </p>
  
  <pre><code>&lt;?php
  
  $database = conn
  
  if (mysqli_connect_error()) {
  
      alert ("Ingen kontakt med server.");
  
  }
  
  if (isset($_POST ["finnKlasse"])) {
  
      $klassekode=$_POST ["klassekode"];  
      $sqlSetning= "SELECT STUDENT.bildenr, STUDENT.fornavn, STUDENT.etternavn, BILDE.filnavn FROM STUDENT INNER JOIN BILDE ON STUDENT.bildenr=BILDE.bildenr WHERE STUDENT.klassekode=$klassekode;";
      $sqlResultat=mysqli_query($database,$sqlSetning) or die ("Errormessage");
  
      $rad=mysqli_fetch_array($sqlResultat); 
  
      print("$rad");
  
  }
  </code></pre>
  
  <p>I now get the error message, </p>
  
  <blockquote>
    <p>whereas I would like a table output with STUDENT.bildenr,
    STUDENT.fornavn, STUDENT.etternavn, BILDE.filnavn (it works in
    phpMyAdmin).</p>
  </blockquote>