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
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>";								
									}
							}

 

 

 

Link to comment
Share on other sites

Sorry, forum wont let me edit... fix to my comment below

 

Also i noticed when i removed the limit 0,10 completely... it pulled all the correct results but again displayed them random amount of times instead of just 1 per result.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.