Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHPÓëMYSQLµÄ´æ´¢¹ý³Ì

ʵÀýÒ»£ºÎ޲εĴ洢¹ý³Ì
$conn = mysql_connect('localhost','root','root') or die ("Êý¾ÝÁ¬½Ó´íÎó!!!");
mysql_select_db('test',$conn);
$sql = "
create procedure myproce()
begin
INSERT INTO user (id, username, sex) VALUES (NULL, 's', '0');
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproceµÄ´æ´¢¹ý³Ì
$sql = "call test.myproce();";
mysql_query($sql);//µ÷ÓÃmyproceµÄ´æ´¢¹ý³Ì£¬ÔòÊý¾Ý¿âÖн«Ôö¼ÓÒ»ÌõмǼ¡£
ʵÀý¶þ£º´«Èë²ÎÊýµÄ´æ´¢¹ý³Ì
$sql = "
create procedure myproce2(in score int)
begin
if score >= 60 then
select 'pass';
else
select 'no';
end if;
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproce2µÄ´æ´¢¹ý³Ì
$sql = "call test.myproce2(70);";
mysql_query($sql);//µ÷ÓÃmyproce2µÄ´æ´¢¹ý³Ì,¿´²»µ½Ð§¹û£¬¿ÉÒÔÔÚcmdÏ¿´µ½½á¹û¡£
ʵÀýÈý£º´«³ö²ÎÊýµÄ´æ´¢¹ý³Ì
$sql = "
create procedure myproce3(out score int)
begin
set score=100;
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproce3µÄ´æ´¢¹ý³Ì
$sql = "call test.myproce3(@score);";
mysql_query($sql);//µ÷ÓÃmyproce3µÄ´æ´¢¹ý³Ì
$result = mysql_query('select @score;');
$array = mysql_fetch_array($result);
echo '<pre>';print_r($array);
ʵÀýËÄ£º´«³ö²ÎÊýµÄinout´æ´¢¹ý³Ì
$sql = "
create procedure myproce4(inout sexflag int)
begin
SELECT * from user WHERE sex = sexflag;
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproce4µÄ´æ´¢¹ý³Ì
$sql = "set @sexflag = 1";
mysql_query($sql);//ÉèÖÃÐÔ±ð²ÎÊýΪ1
$sql = "call test.myproce4(@sexflag);";
mysql_query($sql);//µ÷ÓÃmyproce4µÄ´æ´¢¹ý³Ì,ÔÚcmdÏÂÃ濴Ч¹û
ʵÀýÎ壺ʹÓñäÁ¿µÄ´æ´¢¹ý³Ì
$sql = "
create procedure myproce5(in a int,in b int)
begin
declare s int default 0;
set s=a+b;
select s;
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproce5µÄ´æ´¢¹ý³Ì
$sql = "call test.myproce5(4,6);";
mysql_query($sql);//µ÷ÓÃmyproce5µÄ´æ´¢¹ý³Ì,ÔÚcmdÏÂÃ濴Ч¹û
ʵÀýÁù£ºcaseÓï·¨
$sql = "
create procedure myproce6(in score int)
begin
case score
when 60 then select '¼°¸ñ';
when 80 then select '¼°Á¼ºÃ';
when 100 then select 'ÓÅÐã';
else select 'δ֪·ÖÊý';
end case;
end;
";
mysql_query($sql);//´´½¨


Ïà¹ØÎĵµ£º

¼¸ÖÖ³£ÓÃPHPÁ¬½ÓÊý¾Ý¿âµÄ´úÂë

PHPÁ¬½ÓÊý¾Ý¿âÖ®PHPÁ¬½ÓMYSQLÊý¾Ý¿â´úÂë < ?php   
$mysql_server_name='localhost'; 
//¸Ä³É×Ô¼ºµÄmysqlÊý¾Ý¿â·þÎñÆ÷  
$mysql_username='root'; 
//¸Ä³É×Ô¼ºµÄmysqlÊý¾Ý¿âÓû§Ãû  
$mysql_password='12345678'; 
//¸Ä³É×Ô¼ºµÄmysqlÊý¾Ý¿âÃÜÂë &nb ......

MySQLÖÐÎÄÂÒÂë½â¾ö·½°¸

˵Ã÷: ÔÚMYSQLÖУ¬Èç¹ûʹÓÃȱʡµÄ×Ö·û¼¯£¬ÔÚ½¨¿â¡¢½¨±íʱ£¬Ä¬ÈÏʹÓõÄÊÇlatin1×Ö·û¼¯£¬
ΪISO 8859-1Î÷Å·×Ö·û¼¯¡£²åÈëÖÐÎÄ×Ö·ûʱ£¬ÓëÖ®²»Æ¥Å䣬¾Í»á³öÏÖÂÒÂë¡£
¡¾½â¾ö·½°¸¡¿
1. ´ò¿ªÎļþ: C:\Program Files\MySQL\MySQL Server 5.0\my.ini;
2. ½«ÆäÖеÄdefault-character-set=latin1¸ÄΪdefault-character-set=gb2312, ......

¼¼Êõ±¸Íü Ϊphp5ÅäÖÃmysql

ÏÖ´æÎÊÌ⣺
1.ÎÞ·¨¼ÓÔØ mcrypt À©Õ¹£¬Çë¼ì²éÄúµÄ PHP ÅäÖá£
°´ÕÕÍøÉÏ˵µÄ¸Ã×öµÄòËƶ¼×öÁË µ«ÊǵÚÒ»´Î´ò¿ªphpmyadminÖ÷ҳʱ »¹ÊÇÓÐÕâ¸öÌáʾ Ææ¹ÖµÄÊǽøÈ¥Ö®ºó ÀïÃæûÓÐÕâ¸öÌáʾ È»ºóÍ˳öÍâÃæҲûÁË
2.ÅäÖÃÎļþÏÖÔÚÐèÒªÒ»¸ö¶ÌÓïÃÜÂë¡£
ÍøÉÏÕÒÁË µ«ÊÇÎÊÌ⻹ÊÇû½â¾ö
×òÌìÎÊÌâÈ«²¿½â¾ö
ÒòΪÅäÖÃÎļþÃû³Æδ¸Ä ÕýÈ·µÄÃû ......

mysqlʵÓÃÃüÁî

Ò») Á¬½ÓMYSQL£º
   ¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £­pÓû§ÃÜÂë
1¡¢Àý1£ºÁ¬½Óµ½±¾»úÉϵÄMYSQL
   Ê×ÏÈÔÚ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëmysql°²×°Ä¿Â¼ÏµÄbinĿ¼Ï£¬ÀýÈ磺 D:\mysql\bin£¬ÔÙ¼üÈëÃüÁîmysql -uroot -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë
£¬Èç¹û¸Õ°²×°ºÃMYSQL£¬³¬¼¶Óû§rootÊÇûÓÐÃÜÂëµÄ£¬¹ÊÖ±½Ó»Ø³ ......

Ãâ·Ñ¿ªÔ´PHPÉ̳Çϵͳ½éÉÜ ÄÏÈý·½

ÖйúÖªÃûµç×ÓÉÌÎñ¹©Ó¦ÉÌ£¨ÅÅÃû²»·ÖÏȺó£©
SHOPEX
꿅᣼www.shopex.cn
¼ò½é£º¹úÄÚʹÓÃÈËÊý×î¶àµÄÃâ·Ñ¶ÀÁ¢B2CÍøµê¹ÜÀíÈí¼þ¡£
ÌØÉ«£ºÆ·ÅÆÀÏ¡¢Óû§¶à£¬Ä£°åÖڶ࣬ģ°å·ÑÓõÍÁ®¡£Ö÷ÒªÃæÏò¸öÈËÓû§£¬²úÆ·µÄ¸½ÊôÅä¼þ¶à,¹¦ÄÜÈ«Ãæ.Ãâ·ÑÍøµêϵͳµÄÀÏ´ó¸ç¡£µ«Ãæ¶ÔÆóÒµÓû§Ê±£¬»ù´¡Èí¼þ²»Êʺϣ¬¶¨ÖÆ¿ª·¢ÒªÇóÓÖÌ«¸ß¡£
µÚ¶þλ¡¢ECSH ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ