RE: [PHP] MySQL Query Help!!!!
| From: | John Holmes | Date: | Fri, 14 Jun 2002 03:25:35 +0000 |
| Subject: | RE: [PHP] MySQL Query Help!!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102132@lists.php.net to get a copy of this message | ||
Man, where do I start. There could be so many things wrong. First of
all, this is a PHP list, not MySQL. Second, use MySQL_error() after you
issue a query to see if an error was returned
http://www.php.net/mysql_error. Third, in this line:
'detail_start_date_y,detail_start_date_m,detail_start_date_d,detail_star
t_time_h,detail_start_time_m' <= '$ttwo'
You are comparing the literal string of 'detail... ' is less than or
equal to a string like '200203041234' or something. That's going to
fail.
You need to go back to your SQL books...
---John Holmes...
> -----Original Message-----
> From: Chris Kay [mailto:Chris.Kay@techex.com.au]
> Sent: Thursday, June 13, 2002 7:33 PM
> To: PHP General List
> Subject: [PHP] MySQL Query Help!!!!
>
>
> I have a rather longer query which I would like to get all records
past
> todays date.
> Here is my query
>
> $ttwo = date("YmdGi");
>
> $dbq = select("select detail.*, type.type_name, status.status_name,
> staff.staff_name, source.source_long,
> source.source_short from detail, type, status, staff,
> source where type.type_id = detail.detail_type && status.status_id =
> detail.detail_status &&
> staff.staff_id = detail.detail_staff && source.source_short =
> detail.detail_source &&
>
'detail_start_date_y,detail_start_date_m,detail_start_date_d,detail_star
t_
> time_h,detail_start_time_m' <= '$ttwo' order by
detail.detail_start_date_m
> DESC, detail.detail_start_date_d DESC");
>
> The query works fine before I try to get all records in the furure as
> shown below
>
>
'detail_start_date_y,detail_start_date_m,detail_start_date_d,detail_star
t_
> time_h,detail_start_time_m' <= '$ttwo'
>
> The query does not error out it just does not give any records, and I
know
> there are 4 records
>
> Detail_start_date_y = 4 digit year
> Detail_start_date_m = 2 digit month
> Deatil_start_date_d = 2 digit day
> Detail_start_time_h = 24 hour time
>
> Can anyone see what I am doing wrong?
>
> Thanks in advance.
>
>
------------------------------------------------------------------------
--
> -
> Chris Kay
> Technical Support - Techex Communications
> Website: www.techex.com.au Email: chris.kay@techex.net.au
> Telephone: 1300 88 111 2 - Fax: (02) 9970 5788
> Address: Suite 13, 5 Vuko Place, Warriewood, NSW 2102
> Platinum Channel Partner of the Year - Request DSL - Broadband for
> Business
>
------------------------------------------------------------------------
--
> -
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php