Hey everyone,
I am trying to work out why the two sets of code below affect each other…
Take a look at this page:
http://www.glofamily.com/inner/index.php
You will see a “Latest News” and “Next Events” column. The Next Events shows an error, the Latest News is fine. But the weird thing is that if i take out the Latest News code (Taken from a WP Blog) the Next Events code works and shows that i want it to show…
Latest News
<?php
require('blog/wp-blog-header.php');
$iNumberOfPosts = 0;
while ($iNumberOfPosts < 1 && have_posts()) : the_post('showposts=1'); ?>
<h4 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h4>
<p><em><?php the_time('j F Y') ?></em></p>
<p style="margin-top:5px"><?php content('60'); ?></p>
<?php $iNumberOfPosts++; ?>
<?php endwhile; ?>
Next Events
<?
$event = Event::selectNextOnStage();
$i = 0;
while($row = mysql_fetch_array($event)){
$date = $row['date'];
$date = strtotime($date);
$date = date("F jS Y",$date);
?>
<div class="stories" style="margin-top:0px">
<p style="float:right"><em><?=$date?></em></p>
<h4><?=$row['title']?></h4>
<img src="http://<?=$_SERVER['SERVER_NAME'].$sitename?>inner/eventimages/<?echo $row['image']?>" alt="" style="width:165px; height:100px; border: 1px solid #c84ae6"/>
<p><?=substr($row['body'], 0, 80);?>...</p>
<a href="http://<?=$_SERVER['SERVER_NAME'].$sitename?>inner/events/?ID=<?echo $row['ID']?>"><img src="images/read-more.png" border="0" style="margin-top:-10px"/></a>
</div>
<div class="clear"></div>
<?
}
?>
Why do i get the error as you will notice on the page i have provided:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /domains/glofamily.com/http/inner/index.php on line 75
Refers to this line:
while($row = mysql_fetch_array($event)){
I know the code actually works because if i take out the Latest News code everything is fine…
Any ideas why this is?
Thanks