Óà PHP µ÷Óà MySQL ´æ´¢¹ý³Ì
MySQL 5.0 ÒÔÉÏÖ§³Ö´æ´¢¹ý³Ì¡£
PHP 5.0 ÒÔÉ쵀 mysqli ϵÁк¯Êý¿ÉÒÔÖ§³Ö²Ù×÷ MySQL µÄ´æ´¢¹ý³Ì¡£
ÒÔÏÂÊÇһЩ¼òµ¥µÄ´æ´¢¹ý³ÌºÍÓà PHP µ÷ÓõÄʾÀý¡£ Ò»¡¢·µ»Øµ¥¸öÊý¾Ý: 1: <?php
2: header("Content-Type:text/html;charset=utf-8");
3:
4: $host = "localhost";
5: $user = "root";
6: $password = "mypassword";
7: $db = "test_store_proc";
8: $dblink = mysqli_connect($host, $user, $password, $db) or die("can't connect to mysql");
9:
10: $dblink->query('SET NAMES UTF8');
11: if ($result = $dblink->query("CALL sp_test0(@num, @x, 123)"))
12: {
13: $rs = $dblink->query("select @num");
14: $row = $rs->fetch_array();
15: echo $row['@num'], '<br>';
16:
17: $rs = $dblink->query("select @x");
18: $row = $rs->fetch_array();
19: echo $row['@x'];
20:
21: mysqli_free_result($rs);
22: }
23: else
24: echo 'error...';
25: mysqli_close($dblink);
26:
27: /*
28: -- Procedure "sp_test0" DDL
29: CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_test0`(OUT num INT, OUT x VARCHAR(16), IN n INT)
30: BEGIN
31: DECLARE nouse int;
32: DECLARE tmp int;
33:
34: SELECT nId INTO nouse from open_news WHERE nID=39;
35: SELECT count(*) INTO tmp from open_news;
36: SET num = tmp;
37:
38: SET x = 'XXX';
39: END;
40: */
41: ?>
42:
¶þ¡¢·µ»Ø½á¹û¼¯:
1: <?php
2: header("Content-Type:text/html;charset=utf-8");
3:
4: $host = "localhost";
5: $user = "root";
6: $password = "mypassword";
7: $db = "te
Ïà¹ØÎĵµ£º
ÆÕͨMySQLÔËÐУ¬Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿²»´óµÄ»°£¬ÊÇ×ã¹»¿ìµÄ£¬µ«Êǵ±Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿¾çÔöµÄʱºò£¬ÄÇô¾Í»áÃ÷ÏÔ·¢ÏÖMySQLºÜÂý£¬ÉõÖÁdownµô£¬ÄÇô¾ÍÒª¿¼ÂÇÓÅ»¯ÎÒÃǵÄMySQLÁË¡£ÆäÖÐÓÅ»¯MYSQLµÄÒ»¸öÖØÒª»·½Ú¾ÍÊÇΪÊý¾Ý¿â½¨Á¢ÕýÈ·ºÏÀíµÄË÷Òý¡£
Èç¹ûûÓÐË÷Òý£¬Ö´ÐвéѯʱMySQL±ØÐë´ÓµÚÒ»¸ö¼Ç¼¿ªÊ¼É¨ÃèÕû¸ö±íµÄËùÓмǼ£¬Ö±ÖÁÕÒµ½·ûºÏÒ ......
ÈýÄêǰתÓïÑÔ×öÁËJ2ee£¬½ñÌìÎÒÓֻص½µÄԵ㡣ÈýÄêÇ°ÎÒÓÃPHPµÄ¿ª·¢ÍøÕ¾µÄ·½Ê½½øÈëÁËÈí¼þÕâ¸öÐÐÒµ£¬Ã»Ïëµ½ÏÖÔÚÎÒÓÖ»ØÀ´ÁË£¬ÕõÔú×ÅÍ´¿àµÄ»ØÀ´ÁË¡£
½«À´µÄÈí¼þ¿ª·¢ºÍ¹ÜÀíÎÒ½«×¨×¢ÓÚ»¥ÁªÍø¼¼ÊõµÄ·¢Õ¹¡£
ÀÎɧ·¢ÍêÁË¡£ÏÖÔÚÈÃÎÒÀ´¼Ç¼һÏÂÎÒ¶ÔSESSIONµÄdz¼û°É¡£
ͨ¹ýini_set('session.use_trans_sid', 0);ÉèÖÃÔËÐл·¾³ÖйØÓÚSESS ......
°²×°»·¾³£ºVMware Workstation 5.5.0 build-18463
Linux°æ±¾£ºRed Hat Enterprise Linux AS (2.6.9-42.EL)
Èí¼þ°æ±¾£ºMySQL5 - mysql-5.0.37.tar.gz
¡¡¡¡¡¡¡¡¡¡Apache2 - httpd-2.2.4.tar.gz
¡¡¡¡¡¡¡¡¡¡PHP5 - php-5.2.1.tar.gz
¡¡¡¡¡¡¡¡¡¡(½«ÒÔÉÏÎļþ±£´æÖÁ/home/tmpĿ¼)
[MySQL]
# cd /home/tmp (½øÈëѹËõ°ü ......
php ͨÓõĵ÷Óà soµÄ·½·¨ÊÇʹÓÃdl()º¯Êý£¬µ«ÊÇÔÚphp5.3Ö®ºó²»ÔÙÖ§³ÖÕâÖÖ·½·¨£¬½öÖ§³Ö¾²Ì¬µ÷Óã¬Ê¹ÓÃdl() ¶¯Ì¬µ÷Óõķ½·¨¼û£º
ÒýÓÃÒ³1: http://tech.idv2.com/2007/07/06/use-local-so-in-php/
¸ÐлÔ×÷ÕßÌṩµÄÇåÎúÃ÷Á˵ķ½·¨£¬µ«ÊÇÎÒÔÚ5.3.1°æ±¾iÖÐûÓÐͨ¹ý£¬ÓÚÊÇÎÒÕÒµ½ÁËÒ³Ã棺
  ......