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

PHPÁ¬½ÓMySQL

<?php
/**
* Mysql DB
*
* @author Administrator
* @package defaultPackage
*/
class MySqlDB{
private $_db;
private static $_instance;
private function __construct(&$db_type){
global $connectionstr;
$conn_db=$connectionstr[$db_type];
$this->_db=mysql_pconnect($conn_db["servername"],$conn_db["usernmae"],$conn_db["pwd"]);
if(!$this->_db){
die("'Could not connect: ".mysql_error());
}
mysql_select_db($conn_db["dbname"],$this->_db);
}
private function __clone(){

}
public static function getInstance(&$db_type){
if(!(self::$_instance instanceof self)){
self::$_instance=new self($db_type);
}
return self::$_instance;
}
function query($sql){
mysql_query("SET NAMES 'GBK'",$this->_db);
return mysql_query($sql,$this->_db);
}
function get_result_sql($sql){
return $this->query($sql);
}
/***¸ù¾Ýsql£¬·µ»ØÊý×éÊý¾Ý,ÓдíÎóÌáʾ***/
function getarray($sql){
$result_ay=array();
if($re=$this->query($sql)){
while ($row=mysql_fetch_array($re)) {
$result_ay[]=$row;
}
}
else {
js_msg("Êý¾Ý·ÃÎÊÓÐ´í£¡",-1);
}
return $result_ay;
}
/***¸ù¾Ýsql£¬·µ»ØÊý×éÊý¾Ý***/
function getarray_no_msg($sql){
$result_ay=array();
if($re=$this->query($sql)){
while ($row=mysql_fetch_array($re)) {
$result_ay[]=$row;
//mysql_fetch_array,mysql_fetch_row,
}
}
return $result_ay;
}
/***ÅúÁ¿²éѯ,×Ö¶ÎÏàͬ£¬·µ»ØÒ»Êý×é***/
function getarray_sqls($sql){
$result_ay=array();
if(is_array($sql)){
//print_r($sql);
foreach ($sql as $k=>$v){
if($re=$this->query($v)){
while ($row=mysql_fetch_array($re)) {
$result_ay[]=$row;
}
}
}
}
else {
$result_ay=$this->getarray_no_msg($sql);
}
return $result_ay;
}
/**
* »ñÈ¡¶à¸ö½á¹û¼¯
*
* @param array sqls
* @return array
*/
function getarrays_sqls($sql){
$result_ay=array();
if(is_array($sql)){
foreach ($sql as $k=>$v){
$temary=array();


Ïà¹ØÎĵµ£º

PHP´éÍøÕ¾Ò»¸ö

ΪÁËÓ¦¸¶Êý×ÖýÌåʵ¼ùСѧÆÚ£¬ÓÃÁ½ÈýÌìµÄʱ¼ä´Ò´ÒææµØ¼ÜÆðÀ´Ò»¸öPHPÍøÕ¾¡£ÍøÕ¾ºÜ´é£¬ÀÏʦ¸øµÄ·ÖÊýÈÃËü¿´ÆðÀ´¸ü´é¡£
×öÕâ¸öÍøÕ¾µÄÄǶÎʱ¼äÕýºÃÔÚ¿´BrooksµÄÄDZ¾¿õÊÀ¾­µä¡¶ÈËÔÂÉñ»°¡·£¬Á˽âÁËÆäÖеēThe Surgical
Team”µÄ¿ª·¢Ä£Ê½£¬¾õµÃÔÚÌØÊⳡºÏÏ£¬ÕâÖÖ¿ª·¢Ä£Ê½È·Êµ»áÓµÓм«¸ßµÄ¿ª·¢Ð§ÂʺÍÍŶÓÕ½¶·Á¦¡£
Ò ......

¹ØÓÚMySQLµÄ1067´íÎó½â¾ö·½·¨

 
ÄÚÈÝ£º
*************
1
°²×°£Í£Ù£Ó£Ñ£Ìºó¸ü¸ÄÁˣңϣϣԵÄÃÜÂëºóÓÃ
net startmysql
Æô¶¯Ê±ÎÒ¾ÍÓöµ½ÁËÕâÑùµÄÎÊÌ⣮ʹÓÃÒÔÏÂÃüÁîºó
c:\mysql\bin\mysqladmin-u root -p shutdown
ÔÙnet start mysql¾ÍûÓÐÕâ¸ö´íÎóÌáʾÁË!
*************
2
MySQLµÄ1067´íÎó
Q£ºÎÒµÄMysqlÅöµ½ÁË 1067 ´íÎó
´íÎóÐÅϢΪ£º
......

Mysql µ¼Èë .sqlÎļþÖÐÎÄÂÒÂ룿

 --default-character-set=utf8 ÓëÐÞ¸ÄsqlÎļþ¼ÓÈ룺SET NAMES 'utf8'; 
µ¼Èë½Å±¾Ê±£¬SET NAMES 'xxx' £¬xxxÓ¦¸ÃºÍsql½Å±¾ÎļþµÄʵ¼Ê±àÂëÒ»Ö£¬Èç¹ûÄãÉèÖõÄʱutf-8 £¬ÄÇôÇëÈ·ÈÏÄãµÄsql½Å±¾Îļþʱutf-8±£´æµÄ:
iconv -f UTF-8 xxx.sql
Èç¹ûÏÔʾÕý³££¬ÄÇôÕâÒ»²½¾ÍOKÁË
ÁíÍâ×¢ÒâÄãµÄ½Å±¾ÀÓÐûÓиø¿â±íÉèÖ ......

mysqlµÄÓ÷¨

 Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
Create DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ