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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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