Need Small PHP help

Discussion in 'PHP' started by the Player, Aug 1, 2014.

  1. #1
    Hi,

    My site suddenly start giving error and i don't know how to fix it, i do not know much php

    Warning: stripslashes() expects parameter 1 to be string, array given in /home4/paarth31/public_html/quality3d/index.php on line 63

    can anyone pls fix this error.

    regards
     
    the Player, Aug 1, 2014 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,897
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Have you changed any of the code?
    Or has a feed into your site changed?

    Can you show us what is on line 63?
     
    sarahk, Aug 1, 2014 IP
  3. the Player

    the Player Well-Known Member

    Messages:
    677
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Hi,

    63 while(stripslashes($rows1=mysql_fetch_array($result1)))

    this error is on all over the site

    website is quality3dmodels.net

    and no, i have not changed anything

    someone also told me to degrade your php version to 5.3

    regards
     
    the Player, Aug 1, 2014 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,897
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Somebody has changed something

    mysql_fetch_array is deprecated which means you shouldn't be using it anymore. I'm on my ipad at the moment so can't view source, what cms are you using? are you on the latest version? can you upgrade it?
     
    sarahk, Aug 1, 2014 IP
  5. yagnik

    yagnik Active Member

    Messages:
    127
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #5
    mysql_fetch_array function will return an Array Object.
    And stripslashes function is work on String variable.
    That's all.
    And if you want to apply stripslashes function on each values of array. Then use array_map.
    <?php
    function stripslashes_fun($value)
    {
    $value = is_array($value) ? array_map('stripslashes_fun', $value) : stripslashes($value);
    return $value;
    }
    $finelResult = stripslashes_fun(mysql_fetch_array($result1));
    /* suppose mysql_fetch_array($result1) = array("n\\'ame", "te\\'st", array("he\\'llo")); */
    print_r($finelResult);
    ?>
    ==================Output==================
    Array
    (
    [0] => n'ame
    [1] => te'st
    [2] => Array
    (
    [0] => he'llo
    )
    )
     
    yagnik, Aug 1, 2014 IP