title: mysqli_error() expects parameter 1 to be mysqli, null given
body: <p>I have a a form that pulls data from a database(mysql to be specific) and echos the data into the <code>value</code> section of <code>&lt;input&gt;</code> tags. It doesn't seem to be working  I have coded a view section of my website to do the same thing but from a different table in my database. I use the same code to make making changes easy and if another developer works on my site in the future. Anyway it doesn't seem to be working I'm not sure why though.</p>
  
  <p>The full error  I get:</p>
  
  <pre><code>Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/caseol5/public_html/jj/admin/news_update.php on line 9 
  </code></pre>
  
  <p>Here is line 9 that the error is referring to:</p>
  
  <pre><code>$result = mysqli_query($link,$sql);
  </code></pre>
  
  <p>I know that both of those function are not null as I did:</p>
  
  <pre><code>echo $link
  echo $sql 
  </code></pre>
  
  <p>before that line after I started feting the error and they both are not null. </p>
  
  <p>Here is the full code segment:</p>
  
  <pre><code>$nid = $_GET['nid'];
  
  include ("../sql/dbConnect.php");
  
  $sql = "SELECT * FROM jj_news WHERE news_id = $nid";
  echo "&lt;p&gt;The SQL Command: $sql &lt;/p&gt;";   
  echo "&lt;p&gt;Link: $link &lt;/p&gt;";
  $result = mysqli_query($link,$sql);
  
  
  if (!$result)
  {
      echo "&lt;h1&gt;You have encountered a problem with the update.&lt;/h1&gt;";
      die( "&lt;h2&gt;" . mysqli_error($link) . "&lt;/h2&gt;") ;  
  }
  $row = mysqli_fetch_array($result);     
  $ntitle = $row['news_title'];
  $ntline = $row['news_titleline'];
  $ndesc = $row['news_desc'];
  $nother = $row['news_other'];
  </code></pre>
  
  <p>I have looked into mysqli_query and I can't find anything I'm missing. I have also tired breaking the code down (and running parts of it and it gives the same error. My guess is it something small that I missed. I've looked at other question on this site that do that are a little similar but none seem to help. I've been looking at this for a while now and need another pair of eyes. </p>
  
  <p><strong>Update</strong></p>
  
  <p>As requested the contents of my <code>dbconnect.php</code> file:</p>
  
  <pre><code>$hostname = "localhost";    
  $username = "caseol5_jjoes";                
  $database = "caseol5_jj_site";              
  $password = "password1";                
  $link = mysqli_connect($hostname, $username, $password, $database); 
  $link = mysqli_connect($hostname,$username,$password,$database) or   die("Error " . mysqli_error($link));
  
  if (!$link)                                     
  { 
      echo "We have a problem!";
  
  }
  </code></pre>