PHPÁ¬½ÓMYSQLÊý¾Ý¿â
<p>04¼¶ÐÂÉúÃûµ¥</p>
<table border="1" width="80%" cellpadding="0">
<tr>
<td width="10%" align="center">Id</td>
<td width="20%" align="center">Name</td>
<td width="10%" align="center">Age</td>
<td width="10%" align="center">Sex</td>
<td width="30%" align="center">Address</td>
<td width="20%" align="center">DoWith</td>
</tr>
<?php
//Á¬½ÓÊý¾Ý¿â
//´ò¿ªÒ»¸öÁ¬½Ó,Á¬½Óµ½±¾µØmysqlÊý¾Ý¿â
$conn=mysql_connect("localhost","root","dalyluo");//ip£¬user£¬pwd
//Ñ¡Ôñ²Ù×÷µÄ×ÊÁÏ¿â
mysql_select_db("test",$conn);// ×ÊÁÏ¿âÃû³Æ,Á¬½Ó
$sql="select * from student";
//ÓÃmysql_queryº¯Êý´Ó×ÊÁÏ¿âÖвéѯ
mysql_query("set names gbk");//´¦ÀíÖÐÎÄÂÒÂëÎÊÌ⣬gbk¿ÉÒÔÊÇÆäËüÖµ
$result=mysql_query($sql,$conn);// search sql, connection
//Ñ»·¶ÁÈ¡¼Ç¼
while($row=mysql_fetch_array($result)){
?>
<tr>
<td width="10%" align="center"><?php echo $row["stuid"] ?></td>
<td width="20%" align="center"><?php echo $row["stuname"] ?></td>
<td width="10%" align="center"><?php echo $row["stuage"] ?></td>
<td width="10%" align="center"><?=$row["stusex"]?></td>
<td width="30%" align="center"><?=$row["stuaddress"]?></td>
<td width="20%" align="center"><a href="#" mce_href="#" onClick="<?php doDel($row["stuid"]) ?>">ɾ³ý</a></td>
</tr>
<?php
}
//¹Ø±ÕÁ¬½Ó
mysql_close($conn);
function doDel($sid){
global $conn;
mysql_select_db("test",$conn);
$del_sql="delect from student where stuid="+$sid;
mysql_query($del_sql,$conn);
}
?>
</table>
Ïà¹ØÎĵµ£º
http://immike.net/blog/2007/04/09/how-not-to-optimize-a-mysql-query/
ÕâÆªÎÄÕ½¨Ò飺
£¨1£©²»ÒªÊ¹ÓÃһЩmysqlµÄtip£¬È磺SQL_SMALL_RESULT, HIGH/LOW_PRIORITY, and INSERT DELAYED£¬STRAIGHT_JOIN£¬³ý·ÇûÓÐÆäËû·½·¨£¬ÒòΪÕâÑùʧȥÁËSQLµÄ¿ÉÒÆÖ²ÐÔ
£¨2£©Êʵ±¶Ô±í½øÐÐË÷Òý
£¨3£©±ÜÃâ¶Ô²»±ØÒªÊý¾ÝµÄ²éѯ
£¨4£©´¦Àí× ......
http://www.mysqlperformanceblog.com/2006/11/12/trying-archive-storage-engine/
£¨1£©ÔÚÏàͬµÄÌõ¼þÏ£¬archiveµÄÊý¾Ý´óСԶСÓÚmyisam
£¨2£©ÔÚѹËõarchiveÊý¾Ýʱ£¬bzip2ºÃÓÚgzip
£¨3£©ÐèÒªÌí¼ÓarchiveµÄ·½·¨ºÍѹËõµÄlevel£¬ÒÔÂú×㲻ͬÓû§µÄÐèÇó
£¨4£©Õâ¸ö´æ´¢ÒýÇæÊÊÓÃÓÚÈÕÖ¾Êý¾Ý
£¨5£©´ËÒýÇæ²»ÄÜupdate,delete£¬²¢ ......
ÈçÏÂphp´úÂë
<?php
$type='a';
$target='type';
$a=array(1,2,3);
a($target);
function a($type)
{
global $$type;
var_dump($$type);
}
?>
Ô¤¼ÆÊä³öµÄÊÇstring(1)”a”
¿ÉÊǽá¹ûÊÇ
Notice: Undefined variable: a in D:\web\global.php on ......
1. °²×°mysqlµÄʱºòÑ¡Ôñ×Ö·û¼¯utf8
2. °²×°½áÊøºóÐÞ¸Ämy.ini,ÓÐÁ½¸öµØ·½ÒªÐ޸ģ¬
[mysql] default-character-set=gbk
# The default character set that will be used when a new schema or table is
# created and no character set ......
¡¡PHPÖÐÎÄÂÒÂëÊÇPHP¿ª·¢Öеij£¼ûÎÊÌâÖ®Ò»¡£PHPÖÐÎÄÂÒÂëÓÐʱ·¢ÉúÔÚÍøÒ³±¾Éí£¬ÓÐЩ²úÉúÔÚÓÚMySQL½»»¥µÄ¹ý³ÌÖУ¬ÓÐʱÓë²Ù×÷ϵͳÓйء£ÏÂ
Ãæ½øÐÐÒ»·¬×ܽᡣ
¡¡¡¡Ò».Ê×ÏÈÊÇPHPÍøÒ³µÄ±àÂë
¡¡¡¡1. phpÎļþ±¾ÉíµÄ±àÂëÓëÍøÒ³µÄ±àÂëӦƥÅä
¡¡¡¡a. Èç¹ûÓûʹÓÃgb2312±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; ......