Hi,
Can anyone help me with getting a php/mysql script where i can have the latest 10 + articals in the main page automatically without me editing the file everytime i add an artical/news!
Would anyone be able to help me!!![]()
Hi,
Can anyone help me with getting a php/mysql script where i can have the latest 10 + articals in the main page automatically without me editing the file everytime i add an artical/news!
Would anyone be able to help me!!![]()
careera,
do you have anything for an example..code or website? i believe i can help, just need clarification. Well this might help..
This will display the database and "LIMIT 10" will only display 10 only and "ORDER BY id DESC" will order the display according to your ID in the DESC order. All this can be found at w3schools
PHP Code:<?php
$con = mysql_connect("localhost","id","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db", $con);
$result = mysql_query("SELECT * FROM table LIMIT 10 ORDER BY id DESC");
while($row = mysql_fetch_array($result))
{ // Example of rows
echo $row['FirstName'];
echo " " . $row['LastName'];
echo " " . $row['Age'];
echo "<br />";
}
mysql_close($con);
?>
Hi and thanks, i'm glad someone is welling to help.
To tell you the truth, i'm a beginer and I just want to know how to it because a friend asked me and I've been looking for some help but never got any.
I'll look for the code or any files that is related and post it and may be you'll be able to assist.
Thanks again.
Bookmarks