Jump to content

how to only return 5 values


therelelogo

Recommended Posts

Hi,

 

I usually hate when people ask someone to basically write thier codes for them, but this kinda feels like one of those times. Basically i only want 5 returns from my code below, rather than every return that matches my criteria.

		<?php
	// Make a MySQL Connection
mysql_connect("", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());


// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM emails WHERE e_to = '{$_SESSION['SESS_LOGON_NAME']}' and e_read = 'NO' ORDER BY ID DESC") 
or die(mysql_error());  

echo "<table border='0'>";
echo "<tr> <th></th> <th></th> <th></th> <th></th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>"; 
echo "[".$row['e_from'];
echo "]";
echo ", re: ";
echo $row['e_subject'];						 
echo "</td></tr>"; 
} 

echo "</table>";
?>

 

if at all possible could someone help modify my code to do what i want?  :shrug: i would be very grateful.

 

Thanks in advance

 

Link to comment
https://forums.phpfreaks.com/topic/221797-how-to-only-return-5-values/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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