程序|数据|数据库
以下粘贴出各个页面的源代码:
db.func:
function GetRows( $Database, $Query ) {
mysql_connect ("ftp", "root", "");
$db = mysql_select_db( $Database );
if ( ! $db ) {
echo "无法连结数据库!";
exit;
}
$rows = mysql_query( $Query );
if ( ! $rows ) {
echo "SQL指令错误!";
exit;
}
return $rows;
}
function ConnectDatabase( $Database ) {
mysql_connect ("ftp", "root", "");
$db = mysql_select_db( $Database );
if ( ! $db ) {
echo "无法连结数据库!";
exit;
}
}
?>
cratetable.php:
function CreateTable() {
$link = mysql_connect ("ftp", "root", "");
$db = mysql_select_db("pcadmin");
if ( ! $db ) {
echo "连接到数据库失败!";
exit;
}
$rows = mysql_query("select * from Profile");
if ( ! $rows ) {
$sql = "Create Table Profile (ID integer auto_increment primary key,Name char(255),Produce char(255),Lianluo char(255),Tel integer(15),Email char(255))";
mysql_query($sql);
}
$rows = mysql_query("select * from Aplication");
if ( ! $rows ) {
$sql = "Create Table Aplication(Name char(255) primary key,IP char(255),Ap char(255),Directory char(255))";
mysql_query($sql);
}
mysql_close ($link);
}
CreateTable();
?>
input.htm:
insert.php:
if ( !empty($Send) ) {
ConnectDatabase( "pcadmin" );
$sql = "insert into Profile(Name,Produce,Lianluo,Tel,Email) values('$Name','$Produce','$Lianluo','$Tel','$Email')";
mysql_query( $sql );
}
?>
show.php:
function ShowOnePage( $rows, $No ) {
mysql_data_seek( $rows, $No );
echo "
" . $field->name . " | ";" . $row[$K] . " | ";
$num = mysql_num_rows($rows);
$Pages = intval(($num - 1) / 10) + 1;
if ( $Page < 1 ) $Page = 1;
if ( $Page > $Pages ) $Page = $Pages;
ShowOnePage( $rows, ($Page-1)*10 );
?>
cxshow.php:
if ($id){
//编辑状態态,选择一条记录
include("../db.func");
mysql_connect("ftp","root","");
mysql_select_db("pcadmin");
$sql = "プロファイルセットを更新 Name='$Name',Produce='$Produce',Lianluo='$Lianluo',Tel='$Tel',Email='$Email' where id=5";
mysql_query($sql);
//$rows = GetRows( "pcadmin", "id=$id のプロファイルから * を選択" );
//$myrow = mysql_fetch_array($rows);
//$id = $myrow["id"] ;
//$Name = $myrow["Name"];
//$Produce = $myrow["Produce"];
//$Lianluo = $myrow["Lianluo"];
//$Tel = $ myrow["Tel"];
//$Email = $myrow["Email"];
echo "你的IDは'$id'";
exit;
} else {
echo "失敗!";
exit;
}
?>
printf.php:
delete.php: