Jump to content

Code to display fields of a table


kemper

Recommended Posts

The $_GET statement 'snags' the age from the url (ex: www.yoursite.com/view.php?age=7) and populates the variable name you've assigned to it which is $age. So...

$age = $_GET['age'];  snags the number 7 from the url and assigns that number as the value of $age.  Now, you need to use that variable in your mysql query like this:

$sql = "SELECT age, division, team FROM MyTable WHERE age='$age'";

Note the $age variable is in the WHERE clause. So, say you had a link on your page for each age like 7, 6 , 10, etc. then the query would simply snag the age from the url and display all people/members/whatevertheyare that have that age. The 'WHERE' clause filters out all the other results since it's looking for everyone (in this case) that is the age of 7.

Make sense?
Link to comment
Share on other sites

Well, if it's any inspiration to you... I didn't know up from scoot about 4 months ago. I practically lived here and read post after post learning all I could. Then I wrote 3 completely different styled scripts on my own with the help of these people that included everything from file uploading to IP banning. One was an entire website in PHP. It'll all make sense once you get the terminology down and the basic concepts of the core functions and database integration.

There's a load of great great sites with tutorials with each explaining it in their own way. I read through dozens of those to find the ones that explained it the way I could understand it. So, check those out and you'll learn faster.
Link to comment
Share on other sites

  • 4 weeks later...
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.