Basically i've searching for tutorials where your main webpage shows for example, the 5 latest news articles you've uploaded to a mysql database.
what is this called, my guess is rss feeding?
Thx for help
Definition help
Started by jamiecarter, Jul 04 2006 07:22 PM
4 replies to this topic
#1
Posted 04 July 2006 - 07:22 PM
#2
Posted 05 July 2006 - 03:47 AM
Do you mean, like displaying 5 things from a database?
In that case it is mySQL all the way, displaying from the database is what you want to do. There is a fair few good tutorials on that in the database here.
(Any mod, this should more be in PHP Help section?)
In that case it is mySQL all the way, displaying from the database is what you want to do. There is a fair few good tutorials on that in the database here.
(Any mod, this should more be in PHP Help section?)
#3
Posted 05 July 2006 - 05:48 AM
topic moved to PHP section.
RSS is a way for people to keep a track of new updates on your website, like adding new photos or adding new pieces of news.
Like Erik said you want to use php and mysql to pull out and display the newest records:
Matt
RSS is a way for people to keep a track of new updates on your website, like adding new photos or adding new pieces of news.
Like Erik said you want to use php and mysql to pull out and display the newest records:
<?php
require_once('mysql_connect.php'); // database connection file
$result = mysql_query("SELECT * FROM `table` ORDER BY `id` DESC LIMIT 0,5"); // pull out the news articles from the table
$num = mysql_num_rows($result); // how many rows are there?
if ($num) { // if there are any rows
while ($row = mysql_fetch_array($result)) { // put the results into an array ready to be displayed
echo "put how you want it to be displayed in here"; // display each news article
}
} else { echo "There are no news articles in the db"; } // error message is there are no news articles in db
?>
Matt
#4
Posted 05 July 2006 - 06:45 AM
thanks guys, now i understand
#5
Posted 05 July 2006 - 09:07 AM
No problems, glad I could be of help.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
