先记下,免得以后想不起来又到处去找!
PHP操作数据库的时候,数据库中数据使用UTF8编码,在读出来的时候,显示的全是???????问号乱码,找了一些资料原来是在读取之前进行一次编码设置:
create table tablename
(
id int not null auto_increment,
title varchar(20) not null,
contnet varchar(300) defalut null,
primary key (‘id’)
)begin=MyISAM DEFAULT CHARSET =UTF8;
在插入数据之前执行:
mysql_query("SET NAMES utf8");
然后 mysql_query("insert into tablename …..")
读出数据之前执行:
mysql_query("SET NAMES utf8");
然后 mysql_query("select * from tablename")
注意:此处读出的编码是把原来编码的内容重新经过编码后输出的,比如输出内容所在页面是GBK编码,那么在读出的时候在页面显示也为乱码,所以在查询之前执行 mysql_query("SET NAMES gbk"),在页面就可以正常显示GBK编码的文字内容
转自:http://www.cnblogs.com/zazl/
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » PHP操作MYSQL乱码 使用SET NAMES utf8校正
波比源码 » PHP操作MYSQL乱码 使用SET NAMES utf8校正
buy levofloxacin 500mg pill buy levaquin 250mg for sale
buy aldactone 100mg for sale valtrex pill order diflucan 200mg generic
generic acillin purchase erythromycin generic buy generic erythromycin 250mg
buy sildenafil 50mg without prescription buy tamoxifen 20mg robaxin tablet
order sildenafil sildenafil 50mg price buy estrace 2mg pills
generic lamictal 50mg buy prazosin 1mg oral retin
order tadalis 10mg pills voltaren price voltaren without prescription
order accutane 20mg online cheap amoxicillin without prescription zithromax 250mg tablet
cialis 5mg sans ordonnance en france cialis 5mg gГ©nГ©rique sildenafil sans ordonnance en france
buy deltasone 5mg online sildenafil 50mg drug viagra online
cialis 20mg generika cialis fГјr frauen sildenafil 50mg kaufen ohne rezept
catapres oral antivert over the counter buy spiriva without prescription
order buspar 10mg generic order ditropan buy oxybutynin generic
alendronate without prescription purchase panadol online pepcid 40mg drug
olmesartan 10mg sale acetazolamide online order acetazolamide 250mg drug
oral prograf order ursodiol online cheap order ursodiol pills
purchase bupropion pills oral seroquel 50mg purchase quetiapine without prescription
cialis order how to order viagra online sildenafil pills
buy revia pills aripiprazole online purchase aripiprazole online
buy medroxyprogesterone microzide tablet order cyproheptadine 4 mg for sale
buy provigil 200mg sale order stromectol 3mg online cheap stromectol 12mg
buy luvox order generic cymbalta glipizide online
isotretinoin 10mg over the counter amoxicillin price prednisone 20mg cheap
buy azithromycin 250mg sale order gabapentin 800mg pills gabapentin tablets
cialis 20 mg price buy cialis for sale levitra or viagra
order lasix 100mg sale buy furosemide hydroxychloroquine 400mg pill
aralen for sale aralen ca order olumiant 4mg for sale
purchase itraconazole tinidazole price tinidazole 500mg sale
zyprexa price nebivolol 5mg generic diovan 160mg cheap
order generic clozapine dexamethasone 0,5 mg sale decadron online buy
oral zyvox 600 mg order zyvox online cheap free slots online
omeprazole 20mg tablet omeprazole 10mg cheap free games poker online
metoprolol 50mg cost lopressor 100mg drug oral vardenafil 10mg
purchase essay online gambling casino free games poker online
buy an essay online affordable term papers buy viagra 50mg sale
clomiphene 100mg uk slot games free real online gambling
cialis for men over 50 sildenafil next day delivery female viagra
order generic aristocort purchase desloratadine without prescription desloratadine uk
priligy 90mg without prescription buy dapoxetine generic cheap levothyroxine pills
levitra or cialis viagra drug buy sildenafil 100mg sale
orlistat 120mg uk xenical drug acyclovir 400mg brand
cialis 10mg ca clopidogrel 75mg drug clopidogrel 150mg cheap
motilium 10mg uk tetracycline 500mg drug flexeril 15mg oral
colchicine medication casino slots gambling online slot games
buy zantac 300mg pills meloxicam 15mg sale celecoxib medication
free spins no deposit usa play roulette poker online for money
tamsulosin 0.2mg generic order zofran 4mg for sale order spironolactone 25mg online
buy zocor without prescription order simvastatin 20mg generic buy propecia 5mg sale
buy flagyl sale buy augmentin 1000mg for sale sulfamethoxazole uk
tadalafil 5mg pills cheapest cialis online buy viagra 50mg
sildenafil 50mg tablets buy cialis 20mg generic us cialis sales
ceftin over the counter ceftin 250mg pills order generic methocarbamol
desyrel sale suhagra 100mg drug order sildenafil pill
poker online game poker online sites modafinil order
oral deltasone 10mg buy deltasone 40mg generic vermox 100mg cheap