public static function encodeGetRecord($tableName, $field, $value, $fields = array())
    {
        $select = "";
        $size = sizeof($fields);
        //Select fields to be returned
        if (sizeof($fields) > 0) {
            foreach ($fields as $i => $column) {
                $select .= " $column";
                if ($i != ($size - 1))
                    $select .= ",";
            }
        } else {
            $select = "*";
        }

        $query = "SELECT $select FROM $tableName WHERE $field = '$value';";
        return $query;
    }
public static function encodeGetRecord($tableName, $field, $value, $fields = array())
    {
        $select = "";
        $size = sizeof($fields);
        //Select fields to be returned
        if (sizeof($fields) > 0) {
            foreach ($fields as $i => $column) {
                $select .= " $column";
                if ($i != ($size - 1))
                    $select .= ",";
            }
        } else {
            $select = "*";
        }

        $query = "SELECT $select FROM $tableName WHERE $field = '$value';";
        return $query;
    }
public static function encodeGetRecord ( $ tableName , $ field , $ value , $ fields = array ( ) ) { $ select = "" ; $ size = sizeof ( $ fields ) ; //Select fields to be returned if ( sizeof ( $ fields ) > 0 ) { foreach ( $ fields as $ i => $ column ) { $ select .= " $column" ; if ( $ i != ( $ size - 1 ) ) $ select .= "," ; } } else { $ select = "*" ; } $ query = "SELECT $select FROM $tableName WHERE $field = '$value';" ; return $ query ; }
Encodes get record statement
@param string $tableName
@param string $field field to match
@param string $value value to match with field
@param array $fields columns to be returned
@return string executable SQL statement
Encodes get record statement