...

View Full Version : Data display problem



bhakti_thakkar
07-31-2007, 04:01 AM
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?? :confused:
Thanks in advance

Fumigator
07-31-2007, 04:45 AM
It's the character encoding of your browser what decides if you can see the correct character or not.

bhakti_thakkar
07-31-2007, 04:50 AM
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

Fumigator
07-31-2007, 04:52 AM
Don't use special characters.

bhakti_thakkar
07-31-2007, 05:02 AM
hi,
the data is entered by the client and it cannot be restricted in any way.... :rolleyes:

shaileshpatil
08-01-2007, 06:28 AM
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?? :confused:
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

bhakti_thakkar
08-01-2007, 08:04 AM
This will surely solve my problem
Million Thanks and :thumbsup:



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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum