Jump to content

Two Scripts, One Page, One Works.... What Gives


Recommended Posts

The company hosting my servers just upgraded the PHP to version 5.2.4 and suddenly several of my pages started to give me the weirdest error. I have two php scripts reaching to the same MySQL database pulling different data from different tables. Both post on the same page, but if both have data to post only the first one in that called data is displayed. If I remove the data from that script the other script displays fine. Hopefully someone understands this crazy description but I'm including the code just in case. Someone please help as I'm on a tight time line to complete these projects and I'm trying not to use my pool stick on this monitor.

 

Page displaying content: main.php

 

<?php

include ('Content/header.inc.php');

?>

  <div class="text_box">

  <div class="top_banner">

<h1>Events</h1>

  </div>

<p><br />

  <?php

include('Scripts/viewevents.php');

?>

  </div>

  <div class="text_box" style="background-color: #000000; color: #FFFFFF;">

    <div class="top_banner">

  <h1>Welcome</h1>

    </div>

<p><img id="main_img" src="Images/kanna003.jpg" alt="Kanna" width="150" height="188" /></p>

<p>Welcome to the home of dance instructor and coreographer Kanna Burch.</p>

<p>Kanna currently instructs classes at Danzeya Dance Studio in Chula Vista, CA and is Artistic Director of the Contagious Flow Dance Company.</p>

<hr />

  <a href="biography.php">Learn More</a>

  <br />

  <div class="images_wrapper">

    <a href="http://www.contagiousflow.com"><img src="Images/Contagious_Flow.jpg" alt="Contagious Flow Logo" width="190" height="91" border="0" /></a></div>

</div>

  <div class="lrg_text_box">

    <div class="top_banner2">

      <h1>Recent Articles</h1>

    </div>

<p><br />

    <?php

include('Scripts/viewnews.php');

?>

</p>

  </div>

<?php

include ('Content/footer.inc.php');

?>

 

viewnews.php

 

<?php

 

include("dbconnect.php");//include the file to connect to the database

 

if(!$id) {

$getnews = mysql_query("SELECT * FROM mynews ORDER BY id DESC LIMIT 1");//query the database for all of the news

 

while($r=mysql_fetch_array($getnews)){

$id = $r['id'];

$title = $r['title'];

$user = $r['user'];

$date = $r['date'];

$message = $r['message'];

 

echo("<div class='blocks'>

<h3>".stripslashes($title)."</h3>

added on $date<br>

".stripslashes($message)."</div>");

}

}

else

{

 

 

$getnews = mysql_query("SELECT * FROM mynews WHERE id = '$id' LIMIT 1");//query the database for 1 of the news

 

while($r=mysql_fetch_array($getnews)){

$id = $r['id'];

$title = $r['title'];

$user = $r['user'];

$date = $r['date'];

$message = $r['message'];

 

echo("<h2>".stripslashes($title)."</h2>

added on $date<br>

".stripslashes($message)."");

}

}

?>

 

 

viewevents.php

 

<?

include("dbconnect.php");//include the file to connect to the database

 

if(!$id) {

$getevents = mysql_query("SELECT * FROM schedule ORDER BY id DESC");//query the database for all of the news

 

while($r=mysql_fetch_array($getevents)){

$id = $r['id'];

$event = $r['event'];

$location = $r['location'];

$date = $r['date'];

$description = $r['description'];

 

echo("<div class='blocks'><p>

<h4>".stripslashes($event)."</h4>

at ".stripslashes($location)."<br />

on $date </p></div><br />");

}

}

else

{

 

 

$getevents = mysql_query("SELECT * FROM schedule WHERE id = '$id' LIMIT 1");//query the database for 1 of the news

 

while($r=mysql_fetch_array($getevents)){

$id = $r['id'];

$event = $r['event'];

$location = $r['location'];

$date = $r['date'];

$description = $r['description'];

 

echo("<h1>".stripslashes($event)."</h1>

<font size=3>at ".stripslashes($location)."</font><br />

<font size=2>on $date</font><br />

<font size=3>".stripslashes($description)."</font>");

}

}

?>

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.