Jump to content

Query not working


Cyonis
Go to solution Solved by Barand,

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.
Edited by Cyonis
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.