NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help using a variable

Anirudhsinh Zala arzala at gmail.com
Wed Dec 17 22:24:42 EST 2008


On Thursday 18 December 2008 05:49:15 Néstor wrote:
> I am passing a variable and value using the query method to myreport.php.
>
> I can see using phpinfo() the query string and the var and the value:
> _GET["drange"]AND (proj_adv_date >=
> DATE_FORMAT(\'2008-12-17\',\'%Y-%m-%d\') AND proj_adv_date <=
> DATE_FORMAT(\'2009-12-17\', \'%Y-%m-%d\'))
> _SERVER["QUERY_STRING"]show=1&proj_owner=Engineering&drange=AND+%28proj_adv
>_date+%3E%3D+DATE_FORMAT%28%272008-12-17%27%2C%27%25Y-%25m-%25d%27%29+AND+pr
>oj_adv_date+%3C%3D+DATE_FORMAT%28%272009-12-17%27%2C+%27%25Y-%25m-%25d%27%29
>%29
>
> _SERVER["REQUEST_URI"]/opps/eco_reports/rep/uco_report.php?show=1&proj_owne
>r=Engineering&drange=AND+%28proj_adv_date+%3E%3D+DATE_FORMAT%28%272008-12-17
>%27%2C%27%25Y-%25m-%25d%27%29+AND+proj_adv_date+%3C%3D+DATE_FORMAT%28%272009
>-12-17%27%2C+%27%25Y-%25m-%25d%27%29%29
>
>
> but when I put the following code in the program dies:
>  $drange  = $_GET['drange'];

Difficult to analyse but Is directive "register_globals" set to "On" either in 
php.ini or in your script?

Btw, passing SQL chunk (i.e implementation logic) via query string is not good 
method. Instead you should pass just necessary values of dates etc.

Thanks

Anirudh Zala

>
> I jjust discovered that if I change the variable to $xdrange the program
> does nto stop
>  $xdrange  = $_GET['drange'];
>
> What????
>
> I need the variable to be $drange because it is a date range that I use to
> create the query and this program calls itself.
>
> What could be causing the problem?  What should I do to use this variable
> $drange?
>
> Thanks,
>
> Nestor :-)





More information about the talk mailing list