lundi 11 juillet 2016

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result?

I've looked all over for a solution to this, but could not find one. I'm trying to output some things from a table.

<?php
include('conn.php');
if ($conn == true) {
  print "yes"; 
} else {
  print "no"; 
}
$articles = mysqli_query($conn, "SELECT * FROM article ORDER BY id DESC;");
while ($row = mysqli_fetch_assoc($articles)) {
  $contentprev = substr($row['content'],0,100)."...";
  $imgsrc = $row['imgsrc'];
  $string = $row['dateAdded'];
  $dateAdded = strtotime($string);
  $weekday = date("l", $dateAdded);
  $month = date("F", $dateAdded);
  $monthday = date("j", $dateAdded);
  $year = date("Y", $dateAdded);
  include('../blog/article-preview.php');
}
?>

With the little test above, I can guarantee I am correctly connected to my database. It seems to not like the 'mysqli_query()' part. Thoughts?

Aucun commentaire:

Enregistrer un commentaire