php ÂÒÂë - PHP / »ù´¡±à³Ì
Êý¾Ý¿âÉèÖÃΪutf8,phpÒ³ÃæÎļþÒ²ÉèÖÃΪutf-8,½øÐвéѯµÄʱºò³öÏÖÂÒÂ룬±ÈÈç×Öĸa»áÆ¥ÅäÖÐÎÄ£¬Ôõô½â¾öÄØ£¿
set names ÄØ£¿ÊDz»ÊÇÄãµÄ¡£htmlÒ³Ãæ±àÂëÎÊÌâ°¡
html±àÂëÒ²ÊÇutf-8µÄ<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
ºÜÆæ¹ÖµÄÊÇ$keywords = iconv("utf-8", "gb2312", $keywords);ÕâÑùתÂëÖ®ºó£¬ÖÐÎÄ¿ÉÒÔÆ¥Å䣬µ«ÊÇ×Öĸ¿ÉÄÜ»áÆ¥Åäµ½ÖÐÎÄ¡£
ËÄÜ°ï棿
µ«ÊÇ×Öĸ¿ÉÄÜ»áÆ¥Åäµ½ÖÐÎÄ
ʲôÒâ˼£¬Ò»Ö±²»¶®Õâ¾ä»°Ê²Ã´Òâ˼
±ÈÈçÎÒËÑË÷ʱÊäÈëÒ»¸ö×Öĸa,µ«ÊÇÆ¥Åäµ½µÄÄÚÈÝÊÇÖÐÎÄ
¶÷£¬Í¦ÉñÆæµÄ
Êý¾Ý¿âÀïÃæµÄÖÐÎIJ»ÄÜÕý³£ÏÔʾ£¬»áÓÐÀàËÆaµÄ×Ö·û
ÊÔϼÓÉÏ
mysql_select_db(".........")//ÕâÒ»¾äºóÃæÖ´ÐÐÒ»´ÎÏÂÃæÕâ¾ä
mysql_query("SET NAMES 'utf8'");
Ò³Ãæµ÷ÓÃÁËJavaScript»òajaxµÈ´¦ÀíÊý¾ÝÂ𣬿ÉÄÜÎÊÌâ¾Í³öÕâ¡£¡£
Ò³Ãæµ÷ÓÃÁËJavaScript»òajaxËü¾³£³ö£¬»òÕß˵ֻҪ²»ÊÇutf-8µÄ»°¿Ï¶¨³öÂÒÂ룬´«¹ýÈ¥ºóÓÃiconv()תϾͺÃÁË
Êý¾Ý¿âÀïÖÐÎIJ»ÄÜÕý³£ÏÔʾ£¿ ÊDz»ÊÇÊý¾Ý¿âÖ§³ÖÖÐÎÄûÓÐÉèÖã¿
show create database faq;
µÃµ½CREATE DATABASE `faq` /*!40100 DEFAULT CHARACTER SET utf8 */
ËùÒÔÊý¾Ý¿âµÄ±àÂëÊÇutf8µÄ£¬µ«ÊDzéѯÊý¾Ý¿âÀïÃæµÄÊý¾ÝÊÇÂÒÂ룬¶øÒ³ÃæÓÖ¿ÉÒÔÏÔʾ³ÉÖÐÎÄ£¬Ôõô»áÕâÑùÄØ£¿
Ö»ÒªÒ³Ãæ+php+mysql ¶¼ÊÇutf8µÄ£¬Ó¦¸ÃûÎÊÌâ¡£
ÄãµÄÄÇaÊDz»ÊÇÈ«½ÇµÄ°¡£¿ ×îºÃ°ÑSQL´òÓ¡³öÀ´£¬È»ºóÔÚºǫ́ÔËÐÐÒ»ÏÂÄǸöSQL ¿´¿´²éѯ³öÀ´Ê²Ã´½á¹û¡£
ĬÈÏÇé¿öÏ£¬MySQLÔÚÖ´ÐвéÕÒʱ²»Çø·Ö×ÖĸµÄ´óСд¡£µ±ÄãÔ
Ïà¹ØÎÊ´ð£º
ÏÖÓÐÒ»PHP¿Õ¼ä£¬Ö§³ÖMYSQLÊý¾Ý¿â
Ϊ½ÚÊ¡·ÑÓã¬ÏÖÏëͨ¹ýÓòÃûתÏòĿ¼ÐÎʽ½øÐйÜÀí£¨¼´½«ÓòÃûA¼Ç¼£Û°üÀ¨¶¥¼¶ÓòÃû¼°¶þ¼¶ÓòÃû£Ý¶¼Ö¸Ïòͬһ¿Õ¼ä£©
È磺·ÃÎÊÓòÃû abcd.cn Ö±½Ó·ÃÎÊÍøÕ¾¸ùĿ¼
·ÃÎʶþ¼¶ÓòÃû ef.abcd.cn ......
ÔÚPHPÖÐÓÐûÓÐÏñASPÖеļǼ¼¯(ADODB.Recordset )ÕâÖÖÀàÐ͵ĶÔÏó?¿É²»¿ÉÒÔÏñÔÚASPÖÐÒ»Ñùͨ¹ý¼Ç¼¼¯À´¸üÐÂÊý¾Ý¿â.ÈçÏÂÃæÕâÑù.
VBScript code:
set rs=server.createobject("adodb.recordset")
......
ÊÇÓñðÈËдµÄÀà×öµÄ£¬»¹ÔʱÌáʾYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO admin(seq,passwd,type,n ......
ÔÚÐÞ¸ÄÍêphp.ini£¬ºÍhpptd.confºó´ò¿ªhttp://localhostÄܹ»ÏÔʾIt Works!ͨ¹ýapacheÖ§³Öphp5²âÑé,²»¹ý²»ÖªµÀΪʲôºóÀ´´ò¿ªhttp://localhostºÍhttp://localhost/index.phpЧ¹û¶¼ÊÇPHPÐÅÏ¢¡£
´ò¿ªhttp://localhost/i ......