Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

using $_SESSION to query table

New Here ,
Jul 08, 2010 Jul 08, 2010

i have a spry menu that has 2 levels.

level 1 has a title of "1960's", "1970's", ext all the way to "2000's"

the second level has the years 1961,1962,1963, ext.

in a table i have all the football scores of my high school.  each line  has the year in it.  1963, town, score, opponent, score

when the user chooses a year, i want it to populate my data set with the year that user chooses.

this is a line from the spry menu.

<li><?php session_id(); $HTTP_SESSION_VARS["yearp"]=1980; ?><a href="all scores.php">1980</a></li>
<li><?php session_id(); $HTTP_SESSION_VARS["yearp"]= 1981;?><a href="all scores.php">1981</a></li>

"all scores.php" is the page that will display the results.

if the user chooses 1980, the results appear from 1981,  which is the last one.  if i were to add another line that had 1982, it would display 1982 scores.

i need it to keep the varable "yearp" value the user chooses and then display that year.

i'm new to this so please bare with me.

any ideas?

Larry

TOPICS
Server side applications
699
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2010 Jul 08, 2010

Hi Larry,

There is no need for session variables. If you want to filter the data you can use a URL variable like year=1960 or similar. Then in the results page you can use PHP to filter the data to that year.

I am assuming that you are using HTMLDataSets to show the results from a table created in the results page.

Your link will look like <a href="results.php?year=1960">, then in the results page you will have a filter where year=$_GET['year'] or similar.

If you need further assistance please post the code for the results page.

Ben

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 09, 2010 Jul 09, 2010

i'm using a dynamic table on the all scores.php page to display the results.  not sure if this makes a difference.

i am using dreamweaver and built the dataset with the wizard.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2010 Jul 09, 2010

i'm using a dynamic table on the all scores.php page to display the results.  not sure if this makes a difference.

i am using dreamweaver and built the dataset with the wizard.

This is the perfect scenario.

Just one remark, when you name your files, do not use a space as in all scores.php ; use all_scores.php instead.

I hope this helps.

Ben

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 09, 2010 Jul 09, 2010
LATEST

thanks ben it worked perfect.

again thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines