Jump to content

Query not working


Cyonis

Recommended Posts

Hello all,

 

This is my first post on this forums and I'm building a webpage using php for the first time, so excuse me if my question is a very simple one and easy to google... I just have no clue where to look.

 

I'm using php to make a connection to my database, which seems to work, because creating tables works.

 

The following code does nothing for some reason:

 

$result = mysqli_query($con,"SELECT * FROM NEWS;");
while($row = mysqli_fetch_array($result))
{
 
echo "<div class='news'>";
 
echo "<div class='author'>Author: " . $row['AUTHOR'] . "</div>";
 
echo "<div class='time'>" . $row['TIME'] . "</div>";
 
echo "<div class='post'>" . $row['NEWS'] . "</div>";
 
echo "</div>";
 
}
 
My connection is stored into $con, which works, I have tried and I can create tables using $con.
 
Thank you already for helping, it's much appreciated.
 
Oh, I should add, I get no error messages at all, just no output. It works perfectly local, but as soon as I upload it, it breaks.
Link to comment
https://forums.phpfreaks.com/topic/285388-query-not-working/
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.