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);
?>
相关文档:
1.show status
Threads_connected 当前的连接数
Connections 试图连接到(不管是否成功)MySQL服务器的连接数。
Max_used_connections 服务器启动后已经同时使用的连接的最大数量。
2.set GLOBAL max_connections=连接数;
flush privilege ......
MYSQL中只有INNODB和BDB类型的数据表才能支持事务处理!其他的类型是不支持的!
$lnk = mysql_connect("localhost", "root", "");
mysql_select_db("test");
mysql_query("BEGIN");
$query = mysql_query("INSERT INTO test VALUES(1, 'yangjun')&quo ......
代码如下,javascript:alert(document.cookie=”adminuser=”+escape(”admin”));javascript:alert(document.cookie=”adminpass=”+escape(”admin”));javascript:alert(document.cookie=”admindj=”+escape(”1″));
从这句代码可以看出,就是利用了cook ......