hi everyone
i need your help
i want to write a code that gets for me the latest 5 out puts
here is my code

<?php
					$con = mysql_connect("localhost","awah","pass");
					if(!$con)
					{
					echo "cant connect to db".mysql_error();
					}
					$select = mysql_select_db("awah_admin");
					if(!$select)
					{
					echo "cant select db ".mysql_error();
					}
					$query = mysql_query("SELECT*FROM news ORDER BY news DESC");
					while($row = mysql_fetch_array($query))
					{
					echo "<B>".$row['title']."<BR>-------------------------------<BR><B>";
echo $row['news']."<BR>**********************************************<BR>";
}

but this code cant give me the latest 5 news .
so how can i get the lates 5 news . please tell what to do

$query = mysql_query("SELECT * FROM news ORDER BY news DESC limit 0,5");
Use this One

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.