I want to create a table to which 3 different users will post data. The data is just message/news data and each user will only need to post data to one field. So far I have a table with the fields:
ID, Message, Daily_Announcem ent, and News
I want to extract the data posted into each field and display it on a corresponding html page. I have the following code to extract and display the data but it displays everything input into the table and I want to be able to display just the most recent entry from each of the fields. What would be the best way to set up the table and what am I missing to just extract the most recent posting?
<?php
$db = mysqli_connect( "localhost" , "", "","db-jvadmin");
if (!$db)
{
die('Could not connect: ' . mysqli_error()) ;
}
$query = "SELECT * FROM Announcements";
$result = mysqli_query($d b,$query);
while($row = mysqli_fetch_ar ray($result))
{
echo $row[Message'];
}
mysqli_close($d b);
?>
ID, Message, Daily_Announcem ent, and News
I want to extract the data posted into each field and display it on a corresponding html page. I have the following code to extract and display the data but it displays everything input into the table and I want to be able to display just the most recent entry from each of the fields. What would be the best way to set up the table and what am I missing to just extract the most recent posting?
<?php
$db = mysqli_connect( "localhost" , "", "","db-jvadmin");
if (!$db)
{
die('Could not connect: ' . mysqli_error()) ;
}
$query = "SELECT * FROM Announcements";
$result = mysqli_query($d b,$query);
while($row = mysqli_fetch_ar ray($result))
{
echo $row[Message'];
}
mysqli_close($d b);
?>
Comment