PhpÓëMysql
PhpÁ¬½ÓmysqlµÄº¯ÊýÈçÏ£º
mysql_connect("Ö÷»úÃû","Óû§Ãû","ÃÜÂë");//´ò¿ªÒ»¸öÁ¬½Ó
mysql_select_db("´ò¿ªÊý¾Ý¿â",Á¬½Ó±êʶ·û);//´ò¿ªÒ»¸öÊý¾Ý¿â
$conn=@mysql_connect("localhost","root","") or die("Á´½Ó´íÎó");ÕâÀï@¿ÉÒÔÒþ²Ø´íÎóÌáʾ,or die¿ÉÒÔÔÚ´íÎóµÄʱºòÏÔʾ¡£
Ö´ÐÐsqlÓï¾äµÄº¯Êý:
mysql_query();
$sql="select * from test";
$result=@mysql_query($sql,$conn) or die(mysql_error());
Á½ÖÖ²éѯº¯Êýmysql_fetch_row()ºÍmysql_fetch_array()µÄÇø±ð£º
Á½ÖÖ¶¼Êǽ«²éѯ½á¹û±£´æµ½Êý×飬µ«ÊÇrow±£´æºóÖ»ÄÜͨ¹ýϱê·ÃÎÊ£¬array»¹¿ÉÒÔͨ¹ýË÷Òý·ÃÎÊ
Ïà¹ØÎĵµ£º
1. дһ¸öº¯Êý£¬¾¡¿ÉÄܸßЧµÄ£¬´ÓÒ»¸ö±ê×¼ url
ÀïÈ¡³öÎļþµÄÀ©Õ¹Ãû
ÀýÈç: http://www.sina.com.cn/abc/de/fg.php
?id=1
ÐèҪȡ³ö php »ò .php
2. ÔÚ HTML ÓïÑÔÖУ¬Ò³ÃæÍ·²¿µÄ meta ±ê¼Ç¿ÉÒÔÓÃÀ´Êä³öÎļþµÄ±àÂë
¸ñʽ£¬ÒÔÏÂÊÇÒ»¸ö±ê×¼µÄ meta Óï¾ä
<META http-equiv='Content-Type
' ......
1. ¾¡Á¿²ÉÓôóÁ¿µÄPHPÄÚÖú¯Êý¡£
2. echo ±È print ¿ì¡£
3. ²»Òª°Ñ·½·¨Ï¸·ÖµÃ¹ý¶à£¬×ÐϸÏëÏëÄãÕæÕý´òËãÖØÓõÄÊÇÄÄЩ´úÂ룿
4. ÔÚÖ´ÐÐforÑ»·Ö®Ç°È·¶¨×î´óÑ»·Êý£¬²»ÒªÃ¿Ñ»·Ò»´Î¶¼¼ÆËã×î´óÖµ¡£
5. ×¢ÏúÄÇЩ²»ÓõıäÁ¿ÓÈÆäÊÇ´óÊý×飬ÒÔ±ãÊÍ·ÅÄÚ´æ¡£
6. ²¢·ÇÒªÓÃÀàʵÏÖËùÓеÄÊý¾Ý½á¹¹£¬Êý×éÒ²ºÜÓÐÓá£
7. $row['id']µÄÐ ......
¡öPDOΪºÎÎ
POD£¨PHP Data Object£©À©Õ¹ÔÚPHP5ÖмÓÈ룬PHP6Öн«Ä¬ÈÏʶÓÃPDOÁ¬½ÓÊý¾Ý¿â£¬ËùÓзÇPDOÀ©Õ¹½«»áÔÚPHP6±»´ÓÀ©Õ¹ÖÐÒƳý¡£¸ÃÀ©Õ¹ÌṩPHPÄÚÖÃÀà PDOÀ´¶ÔÊý¾Ý¿â½øÐзÃÎÊ£¬²»Í¬Êý¾Ý¿âʹÓÃÏàͬµÄ·½·¨Ãû£¬½â¾öÊý¾Ý¿âÁ¬½Ó²»Í³Ò»µÄÎÊÌâ¡£
ÎÒÊÇÅäÖÃÔÚwindowsÏÂ×ö¿ª·¢Óõġ£
¡öPDOµÄÄ¿±ê
ÌṩһÖÖÇáÐÍ¡¢ÇåÎú¡¢·½±ãµÄ A ......
1.PHPÊÇPHP: Hypertext PreprocessorµÄËõд,ÖÐÎÄÒëΪPHP:³¬Îı¾Ô¤´¦ÀíÆ÷.
2.PHPÊÇÒ»ÖÖ¼òµ¥µÄ,ÃæÏò¶ÔÏóµÄ,½âÊÍÐ͵Ä,½¡×³µÄ,°²È«µÄ,ÐÔÄܷdz£¸ßµÄ,¶ÀÁ¢Óڼܹ¹µÄ,¿ÉÒÆÖ²ÐÔµÄ,¶¯Ì¬µÄ·þÎñÆ÷¶Ë½Å±¾ÓïÑÔ.
3.PHP¾ßÓпçƽ̨ÐÔ,ÔÚ´ó¶àÊýUNIXƽ̨,Linuxƽ̨ºÍ΢ÈíWindowsƽ̨É϶¼¿ÉÒÔÔËÐÐ.
4.PHPÖ§³ÖJDBC,ÌṩMYSQL,Oracle,SybaseºÍM ......
±ê×¼´úÂëÈçÏÂ:
<?php
...
?>
¶Ì±êǩģʽ(´ËģʽÐèÒªÐÞ¸ÄPHPÅäÖã¬ÈÃPHPÖ§³Ö¶Ì±êǩģʽ)£º
<?
...
?>
×¢ÊÍ£º
/* ...*/
//
#
ÆäËü£º
ÔÚphpÖÐÓÃ";"À´·Ö¸ôÓï¾ä¡£
Àý¾ä£º
<?php
echo "Hello World!"
?>
......