Jump to content

isset command


Smee

Recommended Posts

Hi,

 

I am trying to create a short list of new members that have registered to a site in PHP. This is what i have so far and i am getting an 'Undefined index: first_name' error.

 

If i am right in thinking i need an (isset($_POST['??']) command somewhere in my code. If someone can point me in the right direction i'd be much appreciated.

 

Cheers

 

            <?php

		require_once ('../mysql_connect.php');

		$result = mysql_query("SELECT 3 FROM users ORDER BY user_id");

		echo "<table border='0'>
				<tr>
				<th>First Name</th>
				<th>Post Code</th>
				<th>Team Supported</th>
				</tr>";

		while($row = mysql_fetch_array($result))
			  {
			  echo "<tr>";
			  echo "<td>" . $row['first_name'] . "</td>";
			  echo "<td>" . $row['post_code'] . "</td>";
			  echo "<td>" . $row['team_supported'] . "</td>";
			  echo "</tr>";
			  }
			echo "</table>";

		?>

 

Link to comment
https://forums.phpfreaks.com/topic/204022-isset-command/
Share on other sites

Of course it is i was thinking of something else at the time.

 

It works fine but what i was trying to do by using a 3 would be only to show three results and for it to list these by highest user_id first.

 

I was thinking something like this but it shows the lowest user_id first rather than last.

 


$result = mysql_query("SELECT first_name, post_code, team_supported FROM users ORDER BY user_id LIMIT 3");

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/204022-isset-command/#findComment-1068579
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.