neo115162 Posted March 16, 2013 Share Posted March 16, 2013 Hello, I am having problems retrieving results for a particular query which is for events. Every time I type a particular word to search for in the news table I get results and when I do for events it doesn't show. I tried troubleshooting the problem and realized that if I do print mysql_num_rows($resEvents); I will get a result which is more than 0. Can anybody help me with this issue? Thanks in advance.searchresults.php Quote Link to comment https://forums.phpfreaks.com/topic/275728-multiple-mysql_fetch_array/ Share on other sites More sharing options...
neo115162 Posted March 17, 2013 Author Share Posted March 17, 2013 Maybe my question is unclear. I am calling two queries, namely; $resNews = $connect->get_query("SELECT id,".strtolower($_GET['lang'])."_heading,".strtolower($_GET['lang'])."_story,DATE_FORMAT(date_ins, '%b %d %Y, %h:%i %p') FROM news WHERE ($partsNews) AND ".strtolower($_GET['lang'])."_heading IS NOT NULL AND publish = 'yes'"); $resEvents = $connect->get_query("SELECT id,".strtolower($_GET['lang'])."_title,".strtolower($_GET['lang'])."_description,DATE_FORMAT(date_ins, '%b %d %Y, %h:%i %p') FROM events WHERE ($partsEvents) AND ".strtolower($_GET['lang'])."_title IS NOT NULL AND event_datum >= NOW() AND publish = 'yes'"); I want to display them seperately, like this; <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php while (($arrNews=mysql_fetch_array($resNews, MYSQL_NUM))!==FALSE) { ?> <tr> <td><a href="news_details.php?lang=<?php print $_GET['lang'];?>&newsid=<?php print $arrNews[0];?>"><?php print html_entity_decode($arrNews[1]);?></a> [<i><?php print $arrNews[3]; ?></i>]</td> </tr> <tr> <td><?php print limit_characters(html_entity_decode($arrNews[2]),150);?></td> </tr> <?php } mysql_free_result($resNews); ?> <?php while (($arrEvents=mysql_fetch_array($resEvents, MYSQL_NUM))!==FALSE) { ?> <tr> <td><a href="eventdetails.php?lang=<?php print $_GET['lang'];?>&eid=<?php print $arrEvents[0];?>"><?php print html_entity_decode($arrEvents[1]);?></a> [<i><?php print $arrEvents[3]; ?></i>]</td> </tr> <tr> <td><?php print limit_characters(html_entity_decode($arrEvents[2]),150);?></td> </tr> <?php } mysql_free_result($resEvents); ?> </table> I am not getting any results for events, only for news. Can anyone help me? Quote Link to comment https://forums.phpfreaks.com/topic/275728-multiple-mysql_fetch_array/#findComment-1419097 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.