Jump to content

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

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.