php - mysql - get results at mysql prompt, but not through script? -
i'm using php fetch records db , keeps returning "no results found". but, when print query screen , copy , paste @ mysql prompt, 1 row. granted, it's monster query, shouldn't same results? causes happen? suggestions on check?
don't know if it's helpful, here's query:
$q = db_query("select node.nid nid, gallery.field_attach_gallery_value gallery, node.type type, node.vid vid, ce.field_brochure_link_url ce_brochure_url, ce.field_brochure_link_title ce_brochure_title, ce.field_brochure_link_attributes ce_brochure_attributes, location.field_location_value location_field_location_value, ce.field_ongoing_value ce_field_ongoing_value, ce.field_poster_link_url ce_poster_url, ce.field_poster_link_title ce_poster_title, ce.field_poster_link_attributes ce_poster_attributes, ce.field_press_release_link_url ce_press_release_url, ce.field_press_release_link_title ce_press_release_title, ce.field_press_release_link_attributes ce_press_release_attributes, (date_format(str_to_date(ce.field_start_date_value,'%y-%m-%dt%t'),'%m %d, %y %h:%i %p')) start, (date_format(str_to_date(ce.field_start_date_value2,'%y-%m-%dt%t'),'%m %d, %y %h:%i %p')) end, ce.field_web_resources_url ce_web_resources_url, ce.field_web_resources_title ce_web_resources_title, ce.field_web_resources_attributes ce_web_resources_attributes, node_revisions.body body, node_revisions.format node_revisions_format, node.title title node node left join content_field_attach_gallery gallery on node.vid = gallery.vid left join content_type_exhibitions_and_programs ce on node.vid = ce.vid left join content_field_location location on node.vid = location.vid left join node_revisions node_revisions on node.vid = node_revisions.vid (node.status <> 0) , (node.type in ('exhibitions_and_programs')) , '2010-01-19' between (date_format(str_to_date(ce.field_start_date_value, '%y-%m-%dt%t'), '%y-%m-%d')) , (date_format(str_to_date(ce.field_start_date_value2, '%y-%m-%dt%t'), '%y-%m-%d')) order (date_format(str_to_date(ce.field_start_date_value, '%y-%m-%dt%t'), '%y-%m-%d')) desc"); $num = false; while($r = db_fetch_array($q)) { $num = true; $line = 'ok, found something!'; } if($num == true) { print $line; } else { print 'no records found'; }
it seems db_query()
, db_fetch_array()
custom functions. should var_dump($q)
, replace output code @ end entirely var_dump(db_fetch_array($q));
debug info on problem.
Comments
Post a Comment