RE: [PHP] Displaying Results
| From: | Martin Towell | Date: | Wed, 17 Apr 2002 06:01:38 +0000 |
| Subject: | RE: [PHP] Displaying Results | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-93294@lists.php.net to get a copy of this message | ||
I think you can get everything after the ? in the URL with $QUERY_STRING
but I think that it would be a bit dangerous to just accept what's passed, I
think some checking should be done before you use $QUERY_STRING as is
-----Original Message-----
From: Jason Soza [mailto:solja@gci.net]
Sent: Wednesday, April 17, 2002 10:21 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Displaying Results
Sorry, I just noticed that the count() function will do at least the
first part of my question, i.e. SELECT year, COUNT(*) FROM cars GROUP
BY year
But the second part still has me a bit stumped. I know that you can
pass a variable using something like script.php?year=1991, but doesn't
that assume that in your script you have something like:
$query = ("SELECT * FROM mytable WHERE year=$year")
So the $year is the only variable that gets replaced by the script.php?
year=1991 you called it with. How could I make it so that the
entire 'year=$year' part of the query gets replaced by what comes after
the ? in script.php?year=1991 ?
Thanks in advance
Jason
----- Original Message -----
From: Jason Soza <solja@gci.net>
Date: Tuesday, April 16, 2002 2:49 pm
Subject: [PHP] Displaying Results
> Suppose I want a script that goes into a table, looks up all
> records in
> a given field, and groups and displays the results like so:
> match1 (1)
> match2 (5)
> match3 (6)
>
> So basically it looked at the field 'matches' and found a total of
> 12
> records, 1 record for match1, 5 records for match2, and 6 records
> for
> match3. It would also be handy for the output to be a link so when
> you
> clicked on it, it would pass a query on to the database querying
> for
> just that particular field, like:
> SELECT * FROM table WHERE match="match1"
>
> Can someone point me in the right direction for this? Or show me
> an
> example script that would accomplish this? Any help would be
> great.
> Thanks a lot!
>
> Jason
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php