Jump to content

What's wrong with my query...


iPixel

Recommended Posts

This query instead of retuning 10 results it takes the first result and displays it 10 times. Any idea?

 

SELECT 
        a.status       AS  Status, 
        a.title        AS  EventTitle,
        a.url_title	   AS  URLtitle,
        a.entry_date   AS  Date,
        a.weblog_id    AS  WeblogA,
        b.field_id_7   AS  LocationA, 
        b.field_id_202 AS  LocationB,
        b.field_id_61  AS  CategoryA,
        b.field_id_163 AS  CategoryB,
        b.field_id_228 AS  Image,
        b.field_id_8   AS  Time,
        b.field_id_9   AS  Description,
        b.weblog_id	   AS  WeblogB
FROM 
        ee_weblog_titles a, ee_weblog_data b
WHERE
        (a.weblog_id = '12' AND a.weblog_id = b.weblog_id) AND
        (a.status = 'Open' OR a.status = 'Featured') AND
        (b.field_id_7 = '$segment_3' OR b.field_id_202 = '$segment_3') AND
        (a.entry_date >= '$unixtimestamp')
ORDER BY 
	a.entry_date ASC 
LIMIT 0,10

 

$unixtimestamp contains data like -- 1306947337 which is 06/01/2011

Link to comment
https://forums.phpfreaks.com/topic/238125-whats-wrong-with-my-query/
Share on other sites

I'm using a CMS called expression engine. It has it's own query module.. so it looks something like

 

$variablename = $DB->query("select....")

 

then you can print the results array

 

print_r($variablename->results)

.... this show the array stored before i even try to display the data... and it's there 10 times as well. It's 100% a query issue not my php display code.

 

Also i noticed when i removed the limit 0,10 completely... it pulled all the correct results but again displayed them 10 times.

 

but if it bugs you to see how i display the results it's like so....

if ($displayevents->num_rows > 0)
							{
								print_r($variablename->result) . "<BR><BR><BR>";

								foreach($variablename->result as $row)
									{
									      echo $row['EventTitle'] . " - " . $row['Date'] . "<br><br>";								
									}
							}

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.