douruoshen1449 2014-12-14 15:46
浏览 34
已采纳

php pear字符编码

I have some issue with pear since i am beginner in it. Two characters(ő and ü) which is correctly stored in the db appearing on the php page as ?.

I was able to write out correctly the characters in a normal php page by:

mysqli_query($dbc,'SET NAMES UTF8');

This solved that problem but i don't know how to use this in pear.

I use this command for sql accesing

$dg->bind('SELECT * FROM person', $options, 'MDB2');

I try to use this analog:

 $dg->bind('SET NAMES UTF8', $options, 'MDB2');

but this isn't working gives me MDB2 Error: unknown error.

  • 写回答

1条回答 默认 最新

  • duankuai6586 2014-12-14 17:03
    关注
    1. Extend class from Structures_DataGrid_DataSource_MDB2 to get acces to protected _connect() function
    2. Take instantiated databased object like that

      //fill all needed options to create object $dataSource = new Structures_DataGrid_DataSource_MDB2_Extended(); $mdb2 = $dataSource->connect(); $mdb2->exec("SET NAMES utf8");

    3. Bind created data source to your Structures_DataGrid with bindDataSource

    4. Run $dg->bind('SELECT * FROM person', $options, 'MDB2');

    Something like that. I don't check that code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?