¼ÌÐøÕª³£º½ÌÄãÓÃPHPдMySQLÊý¾Ý¿âµÄÓû§ÈÏ֤ϵͳ
Óû§ÈÏÖ¤µÄÔÀíºÜ¼òµ¥£ºÊ×ÏÈÐèÒªÓû§ÔÚÒ³ÃæÉÏÌîÈëÓû§ÃûºÍÃÜÂ룬µ±È»Ã»×¢²áµÄÓû§ÐèÒªÏÈ×¢²á¡£È»ºóµ÷ÓÃÊý¾Ý¿âËÑË÷ÊÇ·ñÓÐÏàÓ¦µÄÓû§¡£Èç¹ûÓоÍÈ·ÈÏ£¬Ã»ÓÐÔòÌáÐÑÓû§ÏÈ×¢²á¡£Ê¹ÓÃPHPÀ´Íê³ÉÕâÒ»Çкܼòµ¥£¬µ«ÐèҪעÒâµÄÊÇÈç¹ûÏëÔÚÒÔºóµÄÒ³ÃæÖж¼ÄÜÈ·ÈÏÓû§Éí·Ý¡£
µÚÒ»²½ÊÇ×öÒ»¸öµÇ¼µÄÒ³Ãæ¡£
µÚ¶þ²½¿ªÊ¼µÇ¼ºóµÄÈ·ÈϳÌÐòµÄÉè¼Æ¡£
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
login.php:¡¡
mysql_connect("localhost","user","password")
/*Á¬½ÓÊý¾Ý¿â£¬Óû§ÃûºÍÃÜÂë×ÔÐÐÐÞ¸Ä*/
or die("ÎÞ·¨Á¬½ÓÊý¾Ý¿â£¬ÇëÖØÊÔ");
mysql_select_db("userinfo")
or die("ÎÞ·¨Ñ¡ÔñÊý¾Ý¿â£¬ÇëÖØÊÔ");
$today=date("Y-m-d H:i:s");
$query="
select id
from usertbl
where name=$name and password=$password
/*´ÓÊý¾Ý¿âÖÐËÑË÷ºÍµÇ¼Óû§ÏàÓ¦µÄ×ÊÁÏ*/
";
$result=mysql_query($query);
$numrows=mysql_num_rows($result);
if($numrows==0){
/*ÑéÖ¤ÊÇ·ñÄÜÕÒ³öÏàͬ×ÊÁϵÄÓû§£¬²»ÄÜÔòδע²á*/
echo ·Ç·¨Óû§
;
echo Çë×¢²áÏÈ
;
echo ÖØÊÔ
;
}
else{
$row=mysql_fetch_array($result);
$id=$row[0];
$query="
update usertbl
set lastlogin=$today
where id=$id";
$result=mysql_query($query);
SetCookie("usercookie", "Ȧ,$name");
¡¡/*ÕâÀïʹÓÃÁËcookie£¬ÒÔ·½±ãÖ®ºóµÄÒ³ÃæÈÏÖ¤¡£
µ«ÎÒ먦·¢ÍêÕâÒ»¿é¡£Ï£ÍûÓÐÐËȤµÄÅóÓÑÖ¸Õý*/
echo µÇ¼³É¹¦
;
echo Çë½ø£¡
;
}
?>
µÚÈý²½×öºÃ×¢²áµÄÒ³Ãæ¡£
µÚËIJ½ÊÇ×¢²áºóµÄÉí·ÝÈ·ÈϺÍÊäÈëÊý¾Ý¿â¡£
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
register.php:
mysql_connect("localhost","user","password")
/*ÇëÐÞ¸ÄÓû§ÃûºÍÃÜÂë*/
or die("ÎÞ·¨Á¬½ÓÊý¾Ý¿â£¬ÇëÖØÊÔ");
mysql_select_db("userinfo")
or die("ÎÞ·¨Ñ¡ÔñÊý¾Ý¿â£¬ÇëÖØÊÔ");
$query="select id from usertbl where name=$name\";
¡¡/*´ÓÊý¾Ý¿âÖÐËÑË÷ÏàͬÃû×ÖµÄÓû§×ÊÁÏ*/
$result=mysql_query($query);
$numrows=mysql_num_rows($result);
if($numrows!=0) /*ÕÒµ½Á˵±È»¾ÍÊÇÓÐÈËÏÈ×¢²áÁËÏàͬµÄÃû×Ö*/
{echo ÒÑÓÐÈË×¢²á´ËÃû£¬ÇëÖØÐÂÑ¡ÔñÃû×Ö!;}
else
{$query="insert into usertbl values(0,$name,$password,\)";
¡¡/*ÕÒ²»µ½ÏàͬµÄ¾ÍÊäÈëеÄÓû§×ÊÁÏ*/
mysql_query($query);
echo ×¢²á³É¹¦;
echo ÇëµÇ¼!;}
?>
ÏÂÒ»²½ÊÇcookieµÄʹÓã¬ÎÒÔ´òËãʹÓÃcookieÀ´Ê¹Ã¿Ò»Ò³¶¼ÄÜʶ±ðÓû§Éí·Ý£¬µ«ÓÉÓÚ±ðµÄÒ³
Ïà¹ØÎĵµ£º
ÕâÀïÊÇÒ»¸öʹÓÃÈÕÆÚº¯ÊýµÄÀý×Ó¡£ÏÂÃæµÄ²éѯѡÔñÁËËùÓмǼ£¬Æädate_colµÄÖµÊÇÔÚ×îºó30ÌìÒÔÄÚ£º
mysql> SELECT something from table
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
DAYOFWEEK(date)
·µ»ØÈÕÆÚdateµÄÐÇÆÚË÷Òý(1=ÐÇÆÚÌ죬2=ÐÇÆÚÒ», ……7=ÐÇÆÚÁù)¡£ÕâЩË÷ÒýÖµ¶ÔÓ¦ÓÚODBC±ê ......
Ò»¡¢
¿ØÖÆÁ÷³Ìº¯Êý
a)
CASE WHEN THEN
º¯Êý
Óï·¨£º
CASE value WHEN [compare-value]
THEN result [WHEN [compare-value] THEN result ……] [ELSE result ] END CASE WHEN
[condition] THEN result [WHEN[condition] THEN result …… ......
mysql 5.0´æ´¢¹ý³Ìѧϰ×ܽá
Ò».´´½¨´æ´¢¹ý³Ì
1.»ù±¾Óï·¨£º
create procedure
sp_name()
begin
………
end
2.²ÎÊý´«µÝ
¶þ.µ÷Óô洢¹ý³Ì
1.»ù±¾Óï·¨£ºcall
sp_name()
×¢Ò⣺´æ´¢¹ý³ÌÃû³ÆºóÃæ±ØÐë¼ÓÀ¨ºÅ£¬ÄÄŸô洢¹ý³ÌûÓвÎÊý´«µÝ
Èý.ɾ³ý´æ´¢¹ý³Ì
1.»ù±¾Óï·¨£º
drop procedure ......
ϵͳ°æ±¾±È½Ï
mixed version_compare ( string version1, string version2 [, string operator] )
version_compare('5.1','<'); //±È½Ïµ±Ç°°æ±¾ÊÇ·ñСÓÚ5.1
ÊÇ·ñ¿ªÆô×Ô¶¯/
get_magic_quotes_gpc()
return 1 on: will add slash.
return 0 off:willn't add.
if(get_magic_quotes_gpc()) {
$cm ......
ΪÁËÓ¦¸¶Êý×ÖýÌåʵ¼ùСѧÆÚ£¬ÓÃÁ½ÈýÌìµÄʱ¼ä´Ò´ÒææµØ¼ÜÆðÀ´Ò»¸öPHPÍøÕ¾¡£ÍøÕ¾ºÜ´é£¬ÀÏʦ¸øµÄ·ÖÊýÈÃËü¿´ÆðÀ´¸ü´é¡£
×öÕâ¸öÍøÕ¾µÄÄǶÎʱ¼äÕýºÃÔÚ¿´BrooksµÄÄDZ¾¿õÊÀ¾µä¡¶ÈËÔÂÉñ»°¡·£¬Á˽âÁËÆäÖеēThe Surgical
Team”µÄ¿ª·¢Ä£Ê½£¬¾õµÃÔÚÌØÊⳡºÏÏ£¬ÕâÖÖ¿ª·¢Ä£Ê½È·Êµ»áÓµÓм«¸ßµÄ¿ª·¢Ð§ÂʺÍÍŶÓÕ½¶·Á¦¡£
Ò ......