Need professional programmer opinion

Discussion in 'PHP' started by deriklogov, Apr 11, 2012.

  1. #1
    Please need your help,

    I had to decode some part of code from ioncube to solve some bugs issue and some part of code wasnt properly decoded
    So PLEASE i need your opinion to figure out which part is not related.

    Here is piece of code :

    //// I just put that function for you to understand what other part of code does
    function sel_rows( $conn, $table, $fieldlist, $condition )
    {
    mysql_query( "SET character_set_results=utf8", $conn );
    $sql = "select {$fieldlist} from {$table} {$condition} ";
    $result = mysql_db_query( db, $sql, $conn );
    if ( !$result )
    {
    echo "Unable to Fetch ".$fieldlist." from ".$table." table.....<br>{$sql}";
    exit( mysql_error( ) );
    return;
    }
    return $result;
    }
    //////

    //// Here is the piece of code by itself


    $table = " class, advertisers,categories ";
    $fieldlist = " class.createDate,advertisers.username,class.url,class.title,class.description,categories.title,class.id,class.image,class.adboxFlag ";
    $condition = " WHERE class.advertiserId = advertisers.id AND class.keywordId = categories.id "." AND class.status='pending' "." ORDER BY class.createDate ASC ";
    $searchwords = sel_rows( $conn, $table, $fieldlist, $condition );
    list( , , , , , , , , $type1 ) = type1 list( , , , , , , , $image ) = image


    so the last line with list () function doesnt make sence, there are no type1 or image arrays before, so I assume they were spliting $searchwods to get
    variable, but its hard to check cause there are so many lines of that in code, what do you think , I am right ?
     
    deriklogov, Apr 11, 2012 IP
  2. e-abi

    e-abi Member

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    38
    #2
    $searchwords = sel_rows( $conn, $table, $fieldlist, $condition ); returns variable type of "MySQL result resource" you cannot split it.
    In order to get the actual results from this $searchwords variable you would need to call mysql_fetch_array() function on it several times. So I quess you are not right.
     
    e-abi, Apr 11, 2012 IP
  3. deriklogov

    deriklogov Well-Known Member

    Messages:
    1,080
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Thanks, That is what I was thinking too.
     
    deriklogov, Apr 11, 2012 IP