Tyger0 Posted October 24, 2007 Share Posted October 24, 2007 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>"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/74542-two-scripts-one-page-one-works-what-gives/ 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.