php+mysqlÖеÄһЩÓï¾ä
mysql½¨Á¢Ò»¸ö±í¸ñ£º
create table hyhtbsc(
id int(4) primary key auto_increment,
username varchar(20),
password varchar(20)
);
²éѯÊý¾Ý¿âÄÚÈÝ£º
<?php
$conn = mysql_connect("localhost","root","pass");
mysql_select_db("mydb",$conn);
$sql = "select * from mytable";
$result = mysql_query($sql,$conn);
while($row = mysql_fetch_array($result)){
echo "<td>".$row['myfield']."</td>";
}
mysql_free_result($result);
mysql_close($conn);
?>
Ìí¼ÓÊý¾Ý¿âÄÚÈÝ£º
<?php
$id=trim($_POST['id']);
$conn = mysql_connect("localhost","root","pass");
mysql_select_db("mydb", $conn);
if($id != ''){
$sql="INSERT INTO ggs_chapter (id) VALUES ('".$book_id."')";
mysql_query($sql,$conn);
echo 'Ìí¼Ó³É¹¦£¡';
}
?>
<form name="add_book" action="" method="post">
<table>
<tr><td>
<select name="id">
<?php
$sql="select * from table";
$result=mysql_query($sql,$conn);
while($row = mysql_fetch_array($result)){
echo "<option value=\"".$row['id']."\">".$row['name']."</option>";
}
mysql_free_result($result);
mysql_close($conn);
?>
Ïà¹ØÎĵµ£º
¿´µ½IEÀïÃæÏÔʾ“Á¬½Ó³É¹¦”µÄ»ÃæÊ±£¬ÕæµÄºÜÐË·Ü¡£Á½ÌìµÄŬÁ¦Ã»°×·Ñ¡£
ÏÖÔÚÀ´×ܽáһϣ¬ÔõôÈÃphpÓëMySQLÁ¬½Ó¡£Ìù³öÀ´£¬ÎªºóÀ´Ñ§Ï°µÄÈËÉÙµã×èÁ¦£¡
ÎÒÓõÄÊÇapache+windows+php+MySQL
´óÌå˵À´ÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊǾɵÄÃæÏò¶Ô¹ý³ÌµÄ·½Ê½£¬ÐèÒª×°ÔØphp_mysql.dll£»ÁíÒ»ÖÖÊÇеÄÃæÏò¶ÔÏóµÄ·½Ê½£¬ÐèÒª×°ÔØphp_mysql ......
Ò»¡¢Îª´ÓÊý¾Ý¿âÉèÖø´ÖÆÕ˺Å
grant REPLICATION SLAVE on *.* To 'backup'@'%' identified by 'backuppwd'
flush privileges
¶þ¡¢µ¼³öÊý¾Ý
(1)Ö±½Ó¸´ÖÆÊý¾ÝÎļþĿ¼·½·¨
a. Í£Ö¹Êý¾Ý¿âдÊý¾Ý
flush tables with read lock
b.ÏÔʾ´ËʱmasterµÄ״̬
show master status
¼ÆÏ´ËʱÖ÷Êý¾Ý¿âµÄbinlogµ ......
±à¼my.cnfÎļþ£¬¼ÓÈ룺
log-slow-queries[=file] #ĬÈÏΪdataĿ¼ÏµÄhostname-slow.logÎļþ
long_query_time=10 (seconds) #Âý²éѯµÄthreshold
log-queries-not-using-indexes #¼Ç¼²»Ê¹ÓÃË÷ÒýµÄ²éѯ
mysqldumpslowÃüÁî»ñµÃÈÕÖ¾ÖÐÏÔʾµÄ²éѯժҪÀ´´¦ÀíÂý²éÑ¯È ......
MYSQLÖÐÖ»ÓÐINNODBºÍBDBÀàÐ͵ÄÊý¾Ý±í²ÅÄÜÖ§³ÖÊÂÎñ´¦Àí£¡ÆäËûµÄÀàÐÍÊDz»Ö§³ÖµÄ£¡
$lnk = mysql_connect("localhost", "root", "");
mysql_select_db("test");
mysql_query("BEGIN");
$query = mysql_query("INSERT INTO test VALUES(1, 'yangjun')&quo ......
1. ½¨Á¢ºÍ¹Ø±ÕÁ¬½Ó
1) mysql_connect()
resource mysql_connect([string hostname [:port][:/path/to/socket][,string username] [,string password]])
ËùÓвÎÊý¶¼ÊÇ¿ÉÑ¡µÄ
¾ÙÀý:
@mysql_connect("localhost", "user", "password")
......