Web Analytics Made Easy -
StatCounter MySQL 5.5 to 5.6 compatibility issues - CodingForum

Announcement

Collapse
No announcement yet.

MySQL 5.5 to 5.6 compatibility issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL 5.5 to 5.6 compatibility issues

    Following code not working with MySQL version 5.6.
    If you are familiar with these coding, please suggest me corrected code.
    You can copy entire code and add fixes.

    PHP Code:
    $temp mysql_query("SELECT id FROM ".C_MYSQL_TEMP." WHERE date < DATE_SUB(NOW(), INTERVAL ".C_REG_DAYS." DAY)");
    while (
    $i mysql_fetch_array($temp))
    {
      
    $tmp mysql_query("SELECT pic1, pic2, pic3 FROM ".C_MYSQL_MEMBERS." WHERE id='".$i['id']."' and status = '0'");
      while (
    $j mysql_fetch_array($tmp))
      {
        for(
    $k 1$k <= 3$k++) 
          {
                
    $tmpm 'pic'.$k;
             if ((
    $j[$tmpm] != '') && (is_file(C_PATH.'/members/uploads/'.$j[$tmpm]))) 
                {
                     @
    unlink (C_PATH.'/members/uploads/'.$j[$tmpm]);
                }    
        }
             @
    mysql_query("DELETE FROM ".C_MYSQL_MEMBERS." WHERE id='".$i['id']."' and status = '0'");
        }    
        @
    mysql_query("DELETE FROM ".C_MYSQL_TEMP." WHERE id='".$i['id']."'");
    }
    /////////////


      
    $temp=mysql_query("SELECT count(*) as total FROM ".C_MYSQL_TEMP." WHERE id='".$id."' AND code='".$code."' AND date > DATE_SUB(NOW(), INTERVAL ".C_REG_DAYS." DAY)");
    $row=mysql_fetch_array($temp);
    $count $row['total'];
    if(
    $count != '0') {
       
    mysql_query("DELETE FROM ".C_MYSQL_TEMP." WHERE id='".$id."' AND code='".$code."'");
       if(
    C_CHECK_REGISTER == '3') {
          
    $status='1';
          
    $str=$w[159];
       } 
       else {
          
    $status='7';
          
    $w[46];
       } 
    mysql_query("UPDATE ".C_MYSQL_MEMBERS." SET status='".$status."' WHERE id='".$id."'");
    $result mysql_query('SELECT email, password FROM '.C_MYSQL_MEMBERS.' WHERE id = \''.$id.'\'');
       while(
    $i=mysql_fetch_array($result)) {
    $tm=array(C_SNAME);
    $subject=template($w[195],$tm);
    switch (
    C_ID) {
      
      case 
    '2':
        
    $sendid=$i['email'];
      break;
      default: 
        
    $sendid=$id;
      break;
      }
    $tm=array($sendid,$i['password'],C_SNAME);
    $message=template($w[197],$tm);
    sendmail(C_FROMM,$i['email'],$subject,$message,'text');
    }
    printm($str.$sendid);
    }

    else {
         unset(
    $id);
         
    printm($w[161]);


  • #2
    Almost all of that code needs a complete rewrite as that database interface was obsolete even in PHP 5.5 (you were meant to start work on replacing it in July 2013 when PHP 5.5 was released if you hadn't already replaced it in the preceding 9 years.

    Also you are hiding errors with @ on the front of statements - something you should never do.

    As to what is specifically causing problems with PHP 5.6 I have no idea as I had stopped using all those antiquated calls by the time I upgraded to PHP 5.2
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

    Comment


    • #3
      Ok thank you for the reply!

      Comment


      • #4
        Remove the @.
        After every mysql_query add
        var_dump(mysql_error());

        That should give you the error that happens.
        Don't use old mysql library
        The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets
        When a white horse is not a horse

        Comment


        • #5
          Also, telling us that code doesn't work is pointless. We already know that since you are posting on a programming help forum.

          You have to describe or show exactly what it is doing and if it's not clear from the result what's wrong, you have to describe or show what the expected result should be.
          Finding out HOW to do something is called research, i.e. keep searching until you find the answer. After you attempt to do something and cannot solve a problem with it yourself, would be when you ask others for help.

          Comment

          Working...
          X