iPixel Posted June 1, 2011 Share Posted June 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/238125-whats-wrong-with-my-query/ Share on other sites More sharing options...
fugix Posted June 1, 2011 Share Posted June 1, 2011 how are you displaying the data? Quote Link to comment https://forums.phpfreaks.com/topic/238125-whats-wrong-with-my-query/#findComment-1223628 Share on other sites More sharing options...
iPixel Posted June 1, 2011 Author Share Posted June 1, 2011 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>"; } } Quote Link to comment https://forums.phpfreaks.com/topic/238125-whats-wrong-with-my-query/#findComment-1223630 Share on other sites More sharing options...
iPixel Posted June 1, 2011 Author Share Posted June 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/238125-whats-wrong-with-my-query/#findComment-1223638 Share on other sites More sharing options...
iPixel Posted June 1, 2011 Author Share Posted June 1, 2011 4 hours wasted because i was using weblog_id instead of entry_id... weblog is not a unique ID. Sorry! Quote Link to comment https://forums.phpfreaks.com/topic/238125-whats-wrong-with-my-query/#findComment-1223682 Share on other sites More sharing options...
fugix Posted June 1, 2011 Share Posted June 1, 2011 4 hours wasted because i was using weblog_id instead of entry_id... weblog is not a unique ID. Sorry! well at least you found the solution Quote Link to comment https://forums.phpfreaks.com/topic/238125-whats-wrong-with-my-query/#findComment-1223695 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.