Jump to content

php 5.3.6 problem


minadreapta

Recommended Posts

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>';

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated