mysql - mysql isteminde sonuçlar elde, ama senaryoya?

2 Cevap php

Ben benim db bazı kayıtları almak için php kullanıyorum ve "sonuç bulunamadı" iade ediyor. Ben ekrana sorgu baskı ve kopyalama ve mysql istemine yapıştırın Ama, ben 1 satır olsun. Farz edelim ki, bir canavar sorgu, ama ben aynı sonuçları almak gerekir? Ne olur bu neden olur? Kontrol etmek için ne herhangi bir öneriniz?

Yararlı olmadığını biliyorum, ama burada sorgu etmeyin:

$q = db_query("SELECT node.nid AS nid, gallery.field_attach_gallery_value AS gallery, 
node.type AS type, node.vid AS vid, ce.field_brochure_link_url AS ce_brochure_url, 
ce.field_brochure_link_title AS ce_brochure_title, 
ce.field_brochure_link_attributes AS ce_brochure_attributes, 
location.field_location_value AS location_field_location_value, 
ce.field_ongoing_value AS ce_field_ongoing_value, 
ce.field_poster_link_url AS ce_poster_url, 
ce.field_poster_link_title AS ce_poster_title, 
ce.field_poster_link_attributes AS ce_poster_attributes, 
ce.field_press_release_link_url AS ce_press_release_url, 
ce.field_press_release_link_title AS ce_press_release_title, 
ce.field_press_release_link_attributes AS ce_press_release_attributes, 
(DATE_FORMAT(STR_TO_DATE(ce.field_start_date_value,'%Y-%m-%dT%T'),'%M %d, %Y %h:%i %p')) AS start, 
(DATE_FORMAT(STR_TO_DATE(ce.field_start_date_value2,'%Y-%m-%dT%T'),'%M %d, %Y %h:%i %p')) AS end, 
ce.field_web_resources_url AS ce_web_resources_url, 
ce.field_web_resources_title AS ce_web_resources_title, 
ce.field_web_resources_attributes AS ce_web_resources_attributes, 
node_revisions.body AS body, 
node_revisions.format AS node_revisions_format, 
node.title AS title 
FROM 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 
WHERE (node.status <> 0) 
AND (node.type in ('exhibitions_and_programs')) 
AND '2010-01-19' BETWEEN (DATE_FORMAT(STR_TO_DATE(ce.field_start_date_value, '%Y-%m-%dT%T'), '%Y-%m-%d')) 
AND (DATE_FORMAT(STR_TO_DATE(ce.field_start_date_value2, '%Y-%m-%dT%T'), '%Y-%m-%d')) 
ORDER BY (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';
}