Jump to content

Multiple mysql_fetch_array


neo115162

Recommended Posts

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

Link to comment
Share on other sites

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?
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.