using define
Moderator: General Moderators
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
using define
i have done :
PHP:
--------------------------------------------------------------------------------
DEFINE ("START_TIME","$startTime");
--------------------------------------------------------------------------------
and when i echo it from an included page i get for eample : 1105592400 - which is unix time!
but when i try to put it in a string like this :
"select * from table1 where AND TAARICH_HASPAKA >= ".START_TIME
the START_TIME is gives me an "empty string" and i see:
"select * from table1 where AND TAARICH_HASPAKA >="
what to do?
thnaks i advance
peleg
PHP:
--------------------------------------------------------------------------------
DEFINE ("START_TIME","$startTime");
--------------------------------------------------------------------------------
and when i echo it from an included page i get for eample : 1105592400 - which is unix time!
but when i try to put it in a string like this :
"select * from table1 where AND TAARICH_HASPAKA >= ".START_TIME
the START_TIME is gives me an "empty string" and i see:
"select * from table1 where AND TAARICH_HASPAKA >="
what to do?
thnaks i advance
peleg
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
i know tht
beacuse of that i wrote START_TIME !!!!
but still when i try to add it to a string it doesnt gives an output!
(only if i wil do echo START_TIME i will see the value!!!)
whay to do?
but still when i try to add it to a string it doesnt gives an output!
(only if i wil do echo START_TIME i will see the value!!!)
whay to do?
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
this is the code :
Code: Select all
"SELECT *,order_header.weight as del_weight FROM order_header,delivery WHERE (order_header.del_id=delivery.del_id) AND
order_header.region_id='".$_REQUESTї'r_region_id']."' AND delivery.round_num=$round_num
and (
(TAARICH_HASPAKA <= $endTime AND TAARICH_HASPAKA >= ".START_TIME." AND TEUDAT_MISH='')
OR (TAARICH_TEUDA >= ".START_TIME ."AND TAARICH_TEUDA <= $endTime )
) ORDER BY LAKOACH"- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
seems to generally work.. syntax error with $endTime vs. $endtime, at least.
Code: Select all
<?php
define('START_TIME', time());
$endtime = 20;
$round_num = 3;
$_REQUESTї'r_region_id'] = 'test';
$sql = "SELECT *,order_header.weight as del_weight FROM order_header,delivery WHERE (order_header.del_id=delivery.del_id) AND
order_header.region_id='".$_REQUESTї'r_region_id']."' AND delivery.round_num=$round_num
and (
(TAARICH_HASPAKA <= $endTime AND TAARICH_HASPAKA >= ".START_TIME." AND TEUDAT_MISH='')
OR (TAARICH_TEUDA >= ".START_TIME ."AND TAARICH_TEUDA <= $endTime )
) ORDER BY LAKOACH";
echo $sql;
?>Code: Select all
SELECT *,order_header.weight as del_weight FROM order_header,delivery WHERE (order_header.del_id=delivery.del_id) AND
order_header.region_id='test' AND delivery.round_num=3
and (
(TAARICH_HASPAKA <= AND TAARICH_HASPAKA >= 1105881775 AND TEUDAT_MISH='')
OR (TAARICH_TEUDA >= 1105881775AND TAARICH_TEUDA <= )
) ORDER BY LAKOACH- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
nope it isnt working look at your code :
this is your code u just gave me :
if you look good you will see that "TAARICH_HASPAKA <= "
misiing the START_TIME !!!!!!!!!!!!
Code: Select all
SELECT *,order_header.weight as del_weight FROM order_header,delivery WHERE (order_header.del_id=delivery.del_id) AND
order_header.region_id='test' AND delivery.round_num=3
and (
(TAARICH_HASPAKA <= AND TAARICH_HASPAKA >= 1105881775 AND TEUDAT_MISH='')
OR (TAARICH_TEUDA >= 1105881775AND TAARICH_TEUDA <= )
) ORDER BY LAKOACHmisiing the START_TIME !!!!!!!!!!!!
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
ok maybe i didint copy wel from my page
but still can u give me your own code that you say it works and i will run it on my end?
thnaks i nadvance
peleg
thnaks i nadvance
peleg
If you can, you should aswell edit the error level reporting to something higher. You should then see more about whats missing...
...and...
should be
...and...
should be
...to name a few problems.
Bad question: "This doesn't work..."
Good question: "I've tried X and Y. But i get the following error: 'Z'. Ideas?"
Code: Select all
Notice: Undefined variable: endTime in \test.php on line 12
Notice: Undefined variable: endTime in \test.php on line 14Code: Select all
TAARICH_HASPAKA >= 1105881775Code: Select all
TAARICH_HASPAKA >= '1105881775'Code: Select all
OR (TAARICH_TEUDA >= ".START_TIME ."ANDCode: Select all
OR (TAARICH_TEUDA >= ".START_TIME ." ANDNote that we dont't tend to give out solutions. We give pointers to what to look at/for. Try to read your code and see if you understand it. Then change it to something that you might think work and test it.pelegk2 wrote:if you look good you will see that "TAARICH_HASPAKA <= "
misiing the START_TIME !!!!!!!!!!!!
Bad question: "This doesn't work..."
Good question: "I've tried X and Y. But i get the following error: 'Z'. Ideas?"