Jump to content

"Query was empty"


Xtrapositive

Recommended Posts

Hi guys , can someone help me with this code its giving me "query was empty Error" its connecting but...?

and please find attached the entire php page for clarity.

Thanks .

 

 

<?php

   

//connect database

 

require_once "connect_to_mysqli.php";

 

//query the datbase

$sqlcommand = "SELECT post_id, title, body From posts ORDER by post_id desc";

 

$query = mysql_query($sqlCommand) or die (mysql_error());

 

while($row = mysql_fetch_array($query)) {

   

      $title = $row["title"];

     

echo "<h3>$title</h3>";

}

// Free the result set if it is large

mysql_free_result($query);

// close mysql connection

mysql_close();

?>

18406_.txtFetching info...

Link to comment
https://forums.phpfreaks.com/topic/262817-query-was-empty/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.