going to try some different things out... the if statement didnt work cuz
when i didnt put a query string at the end of the page name when going to it
it complained about month being an undefined index...


----- Original Message ----- 
From: "Rainer Müller" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 10, 2004 6:33 PM
Subject: [PHP] Re: query strings coming from the same page going back to the
same page


> Andy B schrieb:
> > was wondering if this would work or do i need different code:
> > <?php
> > include("libs/conf.db");
> > if(($_GET['month']==0)||($_GET['month']>12)){
> > $query="SELECT
> >  Type,
> >  StartDate,
> >  EndDate,
> >  Name,
> >  County,
> >  Notes
> > FROM $EventsTable
> > ORDER BY StartDate DESC";
> > } else {
> > $query="SELECT
> >  Type,
> >  StartDate,
> >  EndDate,
> >  Name,
> >  County,
> >  Notes
> > FROM $EventsTable WHERE
> > StartingMonth='{$_GET['month']}'
> > ORDER BY StartDate DESC";}
> > mysql_pconnect($host, $mysqluser, $mysqlpwd)||die(mysql_error());
> > $result=mysql_query($query) or die(mysql_error());
> > ?>
> > then i would have a link on the same page this code came from:
> > <a href="ViewEvents.php?month=1">Jan</a>
> > the link is supposed to reload the same page it came from and be bart of
the
> > query above... the thing im not sure of is if that will work or not or
do i
> > need something else...(new to self referrencing pages)...
>
> Probably it is better to use
> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?month=1">Jan</a>
> Then it is not in dependency to the filename.
>
> And btw. you should check with is_numeric() if the value from
> $_GET['month'] is really a number or you will have an security hole in
> you script.
>
> Rainer
>
> -- 
> 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

Reply via email to