For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > September 2004 > newbe









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author newbe
Québec

2004-09-20, 3:57 pm

Hi everyone and all,

I would like to know if something like this is possible. Let say $minus_me
is an integer from 0 to 15

$result = mysql_query('SELECT * FROM myTable WHERE Date > NOW() -
"$minus_me" ;');

Jean


--

--
http://jeanpierredaviau.com


Québec

2004-09-21, 3:56 pm


I must add I tried it and other possibilities without success.

Maybe ther is another way to do it.

Jean


LÄÊ»ie Techie

2004-09-22, 3:55 am

On Mon, 20 Sep 2004 12:27:45 -0400, Québec wrote:

> Hi everyone and all,
>
> I would like to know if something like this is possible. Let say
> $minus_me is an integer from 0 to 15
>
> $result = mysql_query('SELECT * FROM myTable WHERE Date > NOW() -
> "$minus_me" ;');


Your problem arises from using single quotes.

$result = mysql_query('SELECT * from myTable WHERE Date > NOW() - " .
$minus_me );

Also, if $minus_me is coming from a web form, be sure to verify that it
is, in fact, an integer within your specified range.

HTH,
La'ie Techie

Québec

2004-09-22, 8:57 pm


"La?ie Techie" <laie@win_remove_get_nospam_solutions.com> a écrit dans le
message de news:1095829851.Cg6gS4BHmw0Q4Fx4cCQNqA@teranews...
> On Mon, 20 Sep 2004 12:27:45 -0400, Québec wrote:
>
>
> Your problem arises from using single quotes.
>
> $result = mysql_query('SELECT * from myTable WHERE Date > NOW() - " .
> $minus_me );
>
> Also, if $minus_me is coming from a web form, be sure to verify that it
> is, in fact, an integer within your specified range.
>
> HTH,
> La'ie Techie
>


$minusInt = (int)($_SERVER['QUERY_STRING']+1);
$result = mysql_query("SELECT * FROM etudiants WHERE date > NOW()-
'$minusInt';");

Thank you very much,

Jean Pierre


Charles Pelkey

2004-09-26, 8:55 pm

Look for DATEADD in the MySQL manual

-Charles

"Québec" <Once@WasEno.ugh> wrote in message
news:yTk4d.65356$ir6.2219198@wagner.videotron.net...
>
> "La?ie Techie" <laie@win_remove_get_nospam_solutions.com> a écrit dans le
> message de news:1095829851.Cg6gS4BHmw0Q4Fx4cCQNqA@teranews...
>
> $minusInt = (int)($_SERVER['QUERY_STRING']+1);
> $result = mysql_query("SELECT * FROM etudiants WHERE date > NOW()-
> '$minusInt';");
>
> Thank you very much,
>
> Jean Pierre
>
>
>



Québec

2004-09-27, 3:57 pm

Thanks,



Jean Pierre

Or are you talking
"Charles Pelkey" <c.e.pelkey@sbcglobal.net> a écrit dans le message de
news:OpG5d.13763$yp2.12992@newssvr30.news.prodigy.com...
> Look for DATEADD in the MySQL manual
>
> -Charles
>
> "Québec" <Once@WasEno.ugh> wrote in message
> news:yTk4d.65356$ir6.2219198@wagner.videotron.net...
le[color=darkred]
it[color=darkred]
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com