I an issue that has me completely stumped.
I am simply running a simple query with one parameter, putting the results in an array, and then looping through the array to display the information in a table.
I will post the code at the end, though it is kind of dense, but mostly I’d liek to know what would cause a php script to die with no error?
I would like to note that after the mysql info is put into an array, I print it out right before the foreach loop, and all the info displays.
I have error reporting turned on.
The error only occurs on queries with certain parameters, but not others.
The error does not always occur in the same place, but it does always occur. As it goes through the records, it stops at a random point after a few records have been drawn into the table.
I don’t believe it could be an issue with my functions, as it would give an error.
Anyway, I hope I am making some stupid oversight. I’d appreciate any feedback.
<?php if(isset($_SESSION['submit']) && $_SESSION['search_param'] != ''){ ?>
<br />
<br />
<table id="results_box" cellpadding="0" cellspacing="0">
<?php $bg = 'alt2'; ?>
<?php //echo '<pre>',print_r($results['rows']),'</pre>'; ?>
<?php foreach( $results['rows'] as $row){ ?>
<?php $podcasts = getRelatedPodcasts('item',$row['record_id']); ?>
<?php $images = getRelatedImages('item',$row['record_id']); ?>
<?php $main_image = getAndShowMainImage('item',$row['record_id'],'mini'); ?>
<?php $color_class = str_replace(' ','-',$row['category']); ?>
<?php $people = getRelatedPeople('item',$row['record_id']); ?>
<?php $bg = ($bg == 'alt2' ? 'alt1' : 'alt2'); ?>
<tr class="<?php echo $bg; ?>" onClick="Link('index.php?page=entry&permalink=<?=$row['record_id']; ?>')">
<td class="leftrows <?=$color_class?>">
<?=$main_image?>
</td>
<td class="next-to-leftrows " width="25%">
<div class="text-headroom">
<font class="title-medium">
<?php echo highlight($row['name_title'],$_SESSION['search_param']); ?>
</font>
<br />
<span class="small">
<?=highlight($row['city'],$_SESSION['search_param'])?>, <?=$row['state']?>
• <?=highlight($row['category'],$_SESSION['search_param'])?>
</span>
</div>
</td>
<td class="rows" width="25%">
<div class="text-headroom">
<ul class="small">
<?php
foreach($people['record_ids'] as $key => $person){ ?>
<li><?=highlight(getPersonName($person,'FL'),$_SESSION['search_param'])?></li>
<?php } ?>
</ul>
</div>
</td>
<td class="rows small" width="45%"><?php echo constrainLongText($row['remarks'],150); ?></td>
<td class="rightrows small" align="right" width="25">
<?php if($podcasts['count'] > 0){ ?>
<img src="ui/images/headphones.png" />
<?php } ?>
</td>
</tr>
<?php }
} // end if submit for results ?>
</table>
I had an issue in one of the functions, but the errors weren’t appearing because of the fact that the functions were in another file. Unfortunately, my host sucks and I don’t have access to the php.ini, but by eliminating each function and starting basically from scratch it became apparent where the issue was. Thank you for the pointers.