新建网页 $link=@mysql_pconnect('127.0.0.1','root','');
mysql_select_db('mysql',$link);
$query="SELECT ホスト,ユーザー FROM ユーザー";
$result=mysql_query($query,$link);
//获取的文字列
while($filed=mysql_fetch_field($result)){
echo $filed->name."< br>";
}
echo mysql_affected_rows($link);
//获取行
while($row=mysql_fetch_row($result)){
echo $row[0].$row[1].'
';
}
//$query="CREATE DATABASE my_db";
/*$sql = "CREATE TABLE persons (
FirstName varchar(15),
LastName varchar(15),
Age int
)";*/
/*$sql = "CREATE TABLE persons (personID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(personID),
FirstName varchar(15),
LastName varchar(15),
Age int
)」; 設置主键
*/
/*mysql_query("INSERT INTO persons (FirstName, LastName, Age)
VALUES ('Peter', 'Griffin', '35')");*/
/* $result = mysql_query ("SELECT * FROM 人");
while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . 「」。 $row['LastName'];
echo "
";
}
*/
/*查找
$result = mysql_query("SELECT * FROM Persons
WHERE FirstName='Peter'");
while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . 「」。 $row['LastName'];
echo "
";
}
*/
mysql_close($link);
?>