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»¹¿ÉÒÔͨ¹ýË÷Òý·ÃÎÊ
Ïà¹ØÎĵµ£º
½ñÌìÔÚдһ¸ö¶«Î÷ʱ£¬·¢ÏÖʱ¼äÒ»Ö±¶Ô²»ÉÏ£¬date("Y-m-d h:i:s") ×ÜÊÇÓë·þÎñÆ÷ʱ¼ä²î¼¸¸öСʱ£®
ÔÀ´´Óphp5.1.0¿ªÊ¼£¬php.iniÀï¼ÓÈëÁËdate.timezoneÕâ¸öÑ¡ÏĬÈÏÇé¿öÏÂÊǹرյÄ
Ò²¾ÍÊÇÏÔʾµÄʱ¼ä£¨ÎÞÂÛÓÃʲôphpÃüÁ¶¼ÊǸñÁÖÍþÖαê׼ʱ¼ä
ºÍÎÒÃǵÄʱ¼ä£¨±±¾©Ê±¼ä£©²îÁËÕýºÃ8¸öСʱ
½â¾ö·½Ê½:
Ò»¡ ......
1. ¾¡Á¿²ÉÓôóÁ¿µÄPHPÄÚÖú¯Êý¡£
2. echo ±È print ¿ì¡£
3. ²»Òª°Ñ·½·¨Ï¸·ÖµÃ¹ý¶à£¬×ÐϸÏëÏëÄãÕæÕý´òËãÖØÓõÄÊÇÄÄЩ´úÂ룿
4. ÔÚÖ´ÐÐforÑ»·Ö®Ç°È·¶¨×î´óÑ»·Êý£¬²»ÒªÃ¿Ñ»·Ò»´Î¶¼¼ÆËã×î´óÖµ¡£
5. ×¢ÏúÄÇЩ²»ÓõıäÁ¿ÓÈÆäÊÇ´óÊý×飬ÒÔ±ãÊÍ·ÅÄÚ´æ¡£
6. ²¢·ÇÒªÓÃÀàʵÏÖËùÓеÄÊý¾Ý½á¹¹£¬Êý×éÒ²ºÜÓÐÓá£
7. $row['id']µÄÐ ......
»ù´¡Ìâ
¡¡¡¡1.±íµ¥ÖÐ getÓëpostÌá½»·½·¨µÄÇø±ð?
¡¡¡¡´ð£ºgetÓû§¶Ë½«Êý¾Ý¼Óµ½URLºó£¬¸ñʽΪ”?×Ö¶Î1=ÊäÈëÊý¾Ý1&×Ö¶Î2=ÊäÈëÊý¾Ý2&..."¡£
¡¡¡¡ÓÉÓÚgetÌá½»²ÎÊýºó»áÔÚµØÖ·À¸ÖÐÏÔʾ³öÀ´£¬ËùÒÔ»á²úÉúÑÏÖصݲȫÎÊÌâ¡£
¡¡¡¡get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬ÕâÖ÷ÒªÊÇÒòΪÊÜurl³¤¶ÈÏÞÖÆ;¶øpost¿ÉÒÔ´«Ê ......
(IT°ØÀͼ Ô´´ÎÄÕÂ)Èç¹ûÖ»ÊÇunicodeתutf-8±àÂëµÄËã·¨£¬ÍøÉϵ½´¦¶¼ÊÇÁË£¬²»¹ýºÜ¶àÈËÒ²ÊÇÄã³ÎÒ£¬ÎÒ³Ä㣬¸ù±¾¾Í²»Àí½âwhyºÍdo£¬±¾ÎijýÁ˸ø³ö×î¼òµ¥µÄphp¶Ôunicodeתutf-8±àÂ뺯ÊýÖ®Í⣬ҲÉîÈëÌÖÂÛÁËÕâÁ½ÖÖ±àÂëµÄ¹Øϵ£¬Àí½âºÃÁ˻ᷢÏÖÍøÉÏһЩ¾ÉµÄ¶«Î÷£¬ÊÇÑÏÖضàÓà¼æ¹ýÆڵģ¬ÒòΪ´Óutf-8Á÷ÐпªÊ¼µ½ÏÖÔÚ£¬ÔçÒѾÓÉÔÀ´Áù×Ö½Ú ......
<mce:script language=javascript><!--
var a=0;
// --></mce:script>
<?php
function func1()
{
$t="a=a+1;";
return $t."alert(a)";
}
?>
<?php
echo "<input type=button value='Sure' onclick=\"".func1()."\">";
?> ......