Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Location
    India Mumbai
    Posts
    248
    Thanks
    13
    Thanked 1 Time in 1 Post

    Data display problem

    Hi all,
    i am using PHP pear and MSSQL for developing my application. the problem is i have a currency drop down which i am populating from DB. the problem is while retrieving data in the drop-down, a "?" gets displayed for ??? i dont know how to convert it and display it as "". below is my currency data in the DB.
    Currency_ID | Currency_VC

    1
    2 USD
    3 -
    4 ZAR
    5 GBP
    8 INR

    my php code for populating the DD:
    // first col as PK and second col as data to disp
    function GetDDArray($sqlsta , $db) {
    $result_rid=$db->query($sqlsta);
    //$rnum=$res->numRows();

    while ($result_rid->fetchInto($result_row, DB_FETCHMODE_ASSOC)) {
    extract($result_row);
    $DD_arr[] =array(
    'pk' => $col1,
    'dispdata' => $col2
    );
    }
    //print (count($DD_arr));
    $result_rid->free();
    return $DD_arr;

    }

    $currencyarr=GetDDArray("select Currency_ID as col1 , Currency_VC as col2 from Currency_T ", $db);

    <select name="currencyid" class="txtbox">
    <?foreach($currencyarr as $currarr) { ?>
    <option value="<?=$currarr['pk']?>"><?=$currarr['dispdata']?></option>
    <? } ?>
    </select>

    Can any one please help me in this and tell me why does this happen??? is this a conversion problem??
    Thanks in advance

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    It's the character encoding of your browser what decides if you can see the correct character or not.

  • #3
    Regular Coder
    Join Date
    Sep 2006
    Location
    India Mumbai
    Posts
    248
    Thanks
    13
    Thanked 1 Time in 1 Post
    Hello Fumigator,
    Thanks for your reply. can you help me in how can i eleminate this problem irrespective of any browser???
    Any help most appreciated

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Don't use special characters.

  • #5
    Regular Coder
    Join Date
    Sep 2006
    Location
    India Mumbai
    Posts
    248
    Thanks
    13
    Thanked 1 Time in 1 Post
    hi,
    the data is entered by the client and it cannot be restricted in any way....

  • #6
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bhakti_thakkar View Post
    Hi all,
    i am using PHP pear and MSSQL for developing my application. the problem is i have a currency drop down which i am populating from DB. the problem is while retrieving data in the drop-down, a "?" gets displayed for ??? i dont know how to convert it and display it as "". below is my currency data in the DB.
    Currency_ID | Currency_VC

    1
    2 USD
    3 -
    4 ZAR
    5 GBP
    8 INR

    my php code for populating the DD:
    // first col as PK and second col as data to disp
    function GetDDArray($sqlsta , $db) {
    $result_rid=$db->query($sqlsta);
    //$rnum=$res->numRows();

    while ($result_rid->fetchInto($result_row, DB_FETCHMODE_ASSOC)) {
    extract($result_row);
    $DD_arr[] =array(
    'pk' => $col1,
    'dispdata' => $col2
    );
    }
    //print (count($DD_arr));
    $result_rid->free();
    return $DD_arr;

    }

    $currencyarr=GetDDArray("select Currency_ID as col1 , Currency_VC as col2 from Currency_T ", $db);

    <select name="currencyid" class="txtbox">
    <?foreach($currencyarr as $currarr) { ?>
    <option value="<?=$currarr['pk']?>"><?=$currarr['dispdata']?></option>
    <? } ?>
    </select>

    Can any one please help me in this and tell me why does this happen??? is this a conversion problem??
    Thanks in advance
    Insert this line at the beginning of your php script.

    header('Content-type: text/html; charset=iso-8859-1');

    also read
    http://www.w3.org/International/O-HTTP-charset.en.php

  • #7
    Regular Coder
    Join Date
    Sep 2006
    Location
    India Mumbai
    Posts
    248
    Thanks
    13
    Thanked 1 Time in 1 Post
    This will surely solve my problem
    Million Thanks and


    Quote Originally Posted by shaileshpatil View Post
    Insert this line at the beginning of your php script.

    header('Content-type: text/html; charset=iso-8859-1');

    also read
    http://www.w3.org/International/O-HTTP-charset.en.php


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •