minadreapta Posted July 2, 2011 Share Posted July 2, 2011 hi guys, i have this problem, not really related to WHMCS but i tought i should ask here: in my website's index page (non-whmcs page) i have a small script which pulls out the last 5 announcements from the database and echoes them on that page. when i run this page on php 5.2.17 it works just fine. but when i upgrade the php to 5.3.6 it doesn't work anymore, the page hangs up and doesn't load at all. of course on php 5.3.6 if i take out that script from the page, then it loads jsut fine. i will attach that piece of coding here, maybe someone will tell me what am i doing wrong: require("whmcs/dbconnect.php"); require("whmcs/includes/functions.php"); require("whmcs/init.php"); $x=1; // truncate the text to only 65 chars, add ... to the end function truncate($text) { $text = substr($text,0,100); $text = substr($text,0,strrpos($text,' ')); return $text; } // format the date to mm/dd/yyyy function formatdate($date) { $year = substr ($date, 0, 4); $month = substr ($date, 5, 2); $day = substr ($date, 8, 2); return $day.'.'.$month.'.'.$year; } $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,5"; $result = mysql_query($query); while ($data = mysql_fetch_array($result)) { $id = $data["id"]; $date = $data["date"]; $title = $data["title"]; $announcement = truncate($data['announcement']); $date = formatdate($date); echo ('<p>'.$date.' - <strong>'.$title.'</strong> - '.strip_tags($announcement).'... <a href="/whmcs/announcements.php?id='.$id.'" title="'.$title.'">read more...</a></p>'); $x=false; } if(!$x) echo ''; if($x) echo '<p>There are no announcements in this moment.</p>'; 0 Quote Link to comment Share on other sites More sharing options...
minadreapta Posted July 4, 2011 Author Share Posted July 4, 2011 anybody? sorry to bump... 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted July 4, 2011 Share Posted July 4, 2011 You have 3 requires at the top of the file (init.php is no longer used by the way) after the 3rd one add ini_set('display_errors', 'on'); error_reporting(E_ALL); that should then show you the errors or rather the incompatibilities with php 5.3.6 0 Quote Link to comment Share on other sites More sharing options...
minadreapta Posted July 4, 2011 Author Share Posted July 4, 2011 thanks sparky, the init.php was the culprit, no errors thrown thou, just a hanging process...but as soon as i commented out that line it started working again. thanks again. 0 Quote Link to comment 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.