[PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Matthew Ferry
Hello Everyone Got a simple / stupid question. Worked on this all night. I'm over looking something very basic here. The query event_time brings back the calendar id for each event that is pending in the future. ie 12, 13, 14, 26 (There could be 100 of them out there) The second query

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Brad Bonkoski
Matthew Ferry wrote: Hello Everyone Got a simple / stupid question. Worked on this all night. I'm over looking something very basic here. The query event_time brings back the calendar id for each event that is pending in the future. ie 12, 13, 14, 26 (There could be 100 of them out

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread tg-php
Try this as your SQL. It should give you all the results, then you can use PHP to sort it all out. SELECT * FROM egw_cal WHERE cal_category='501' and cal_id in (SELECT cal_id FROM egw_cal_dates where cal_start $tstamp) -TG = = = Original message = = = Hello Everyone Got a simple /

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Micah Stevens
This is a join - Read up on them, they're very useful and don't require the overhead of a sub-query. SELECT egw_cal.* FROM egw_cal_dates LEFT JOIN egw_cal using (cal_id) where egw_cal_dates.cal_start $tstamp AND egw_cal.cal_category = '501' -Micah On 02/12/2007

Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Matthew Ferry
Thanks Everyone... After I sent that...I got thinking about doing both queries in one statement. So thats what I did. Its working fine... Here is the updated code: ?php $todays_year = date(Y); $todays_month = date(m); $todays_day = date(d); $tstamp = mktime(0, 0, 0, $todays_month,

[PHP-DB] Strange action with =

2007-02-12 Thread Peter Beckman
I'm looping through an array and I did this: $rate = $mydata[$prefix]; Now, in some cases $mydata[$prefix] wasn't set/defined, so I expected $rate to not be defined, or at least point to something that wasn't defined. Instead, PHP 5.1.6 set $mydata[$prefix] to nothing. If I had:

Re: [PHP-DB] Strange action with =

2007-02-12 Thread bedul
sry i don't get what u mean?? - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: PHP-DB Mailing List php-db@lists.php.net Sent: Tuesday, February 13, 2007 8:29 AM Subject: [PHP-DB] Strange action with = I'm looping through an array and I did this: $rate =

[PHP-DB] Re: [PHP-WIN] (DRW) Ordenar por fecha

2007-02-12 Thread bedul
english plz you know.. i'm not native with english.. but using english is very helpfull to me for solve your problem - Original Message - From: Anuack Luna [EMAIL PROTECTED] To: php-windows@lists.php.net Sent: Friday, February 09, 2007 6:28 AM Subject: [PHP-WIN] (DRW) Ordenar por fecha

Re: [PHP-DB] Strange action with =

2007-02-12 Thread Peter Beckman
On Tue, 13 Feb 2007, bedul wrote: sry i don't get what u mean?? I'm looping through an array and I did this: $rate = $mydata[$prefix]; This is how you assign a variable by reference. $rate should be a reference to $mydata[$prefix], not a copy. If I change the value of $rate, the

[PHP-DB] Re: SQL Query - Using variable from another SQL Query

2007-02-12 Thread Mike Morris
I think you don't need to break this into two queries... this is really a SQL question, not a PHP question... Just do a join on the two tables: * where table1.cal_id = table2.cal_id and then have a where clause that does all your filtering: * and table1.Date now() and