conn.php 是數(shù)據(jù)庫(kù)配置文件,你安裝集成環(huán)境的時(shí)候應(yīng)該有提示你輸入數(shù)據(jù)庫(kù)管理員賬號(hào)密碼的(或者有初始密碼),你如果已經(jīng)按給的步驟操作了(記得給你創(chuàng)建的數(shù)據(jù)庫(kù)用戶賦予查詢修改權(quán)限),那應(yīng)該是沒有問題的。

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡(jiǎn)單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)、虛擬主機(jī)、營(yíng)銷軟件、網(wǎng)站建設(shè)、新晃網(wǎng)站維護(hù)、網(wǎng)站推廣。
為了解決問題主要還是要看頁(yè)面跳轉(zhuǎn)前出現(xiàn)的那個(gè)亂碼字符提示的是什么意思,弄清楚了就好解決了
意思就是數(shù)據(jù)結(jié)構(gòu)?
我的解決方案是兩個(gè)表即可
班級(jí)列表,其中包含的字段基本就是: 班級(jí)的唯一ID,班級(jí)的年紀(jì),幾班,任課老師等信息
學(xué)生列表,其中包含的字段基本就是: 學(xué)生唯一的ID,學(xué)生所屬的班級(jí)的唯一ID,以及其他學(xué)生信息
我想,涉及到班級(jí)的信息也就只有那么多,成績(jī)之類全部可以放到學(xué)生表中
如果考試次數(shù)較多,可以在建立一個(gè)專門記錄成績(jī)的表,字段:
試卷唯一的ID,隸屬考試ID,隸屬學(xué)生的唯一ID,成績(jī),日期
等等
其余交給你自己想了
呵呵,這個(gè)我會(huì)代碼我寫下!加注釋...
$link = mysql_connect("localhost", "user", "123");//連接數(shù)據(jù)庫(kù)
mysql_select_db("db");//選擇數(shù)據(jù)庫(kù)
$kkk=_GET('k');
$sql="select * from ttt where kkk='$kkk'";//查詢kkk對(duì)應(yīng)content語(yǔ)句
$set=mysqluery($sql);//執(zhí)行sql語(yǔ)句!
$rs=mysql_fetch_arry($set);
$content=$rs['content'];//取出kkk對(duì)應(yīng)的content
if($content==''){
$content=fff($kkk);//將fff($kkk)賦值給content
//---這里面說加入相應(yīng)字段是不是指插入數(shù)據(jù)庫(kù)里面!如果是
//----那樣的話就再加兩句:$sa="update ttt set content='$content' where kkk='$kkk'";
//-----$set_a=mysql_query($sa);
}else{
echo $content;//輸出$content
}
完成....
你后面說的問題:如果$kkk有重復(fù)那我剛才的語(yǔ)句就把所有kkk=$kkk的全部更新了!
你只想選擇出第一條記錄的話:把查詢語(yǔ)句改成這樣$sql="select top 1 * from ttt where kkk='$kkk'";
還有就是數(shù)據(jù)入庫(kù)的時(shí)候要替換什么東西,讀取出來的時(shí)候還需要還原。這句話不明白!
呵呵,別忘了給我加分哦!
由于你的功能很簡(jiǎn)單,隨便用幾個(gè)類似于table的列表網(wǎng)頁(yè)就行了,給你個(gè)后臺(tái)模板網(wǎng)頁(yè),慢慢看 相信有你喜歡的。
后臺(tái)模板網(wǎng)址:
?php
if(!defined("INCLUDE_MYSQL_OK")) {
define("INCLUDE_MYSQL_OK","");
class MySQL_class {
var $debug = true;
var $db,
$id,
$result, /* 查詢結(jié)果指針 */
$rows, /* 查詢結(jié)果行數(shù) */
$fields, /* 查詢結(jié)果列數(shù) */
$data, /* 數(shù)據(jù)結(jié)果 */
$arows, /* 發(fā)生作用的紀(jì)錄行數(shù)目 */
$iid; /* 上次插入操作后,可能存在的"AUTO_INCREMENT"屬性字段的值,如果為"0",則為空 */
var $user, $pass, $host, $charset;
/*
* 請(qǐng)注意用戶名和密碼是否正確
*/
function Setup ($host, $user, $pass, $charset='utf8') {
$this-host = $host;
$this-user = $user;
$this-pass = $pass;
$this-charset = $charset;
}
function Connect ($db = "") {
global $CFG_MYSQL_INFO;
if (!$this-host) {
$this-host = $CFG_MYSQL_INFO["host"];
}
if (!$this-user) {
$this-user = $CFG_MYSQL_INFO["user"]; /* 在這里作修改 */
}
if (!$this-pass) {
$this-pass = $CFG_MYSQL_INFO["passwd"]; /* 在這里作修改 */
}
if (!$this-charset) {
$this-charset = "utf8"; /* 在這里作修改 */
}
if (empty($db))
$this-db = $CFG_MYSQL_INFO["database"];
else
$this-db = $db;
$this-id = @mysql_connect($this-host, $this-user, $this-pass);
if (!$this-id)
return false;
$this-SelectDB($this-db); /* 定位到指定數(shù)據(jù)庫(kù) */
$this-Query("SET NAMES '".$this-charset."'");
return true;
}
function Close(){
@mysql_close($this-id);
}
function SelectDB ($db) {
if(!@mysql_select_db($db, $this-id))
return false;
else
return true;
}
function Begin () {
$this-result = @mysql_query("START TRANSACTION WITH CONSISTENT SNAPSHOT", $this-id);
if (!$this-result)
return false;
return true;
}
function Commit () {
$this-result = @mysql_query("COMMIT", $this-id);
if (!$this-result)
return false;
return true;
}
function Rollback () {
$this-result = @mysql_query("ROLLBACK", $this-id);
if (!$this-result)
return false;
return true;
}
function Escape ($str) {
$escstr = mysql_escape_string($str);
return $escstr;
}
# 普通查詢功能,主要用于返回結(jié)果是多條記錄的情況
# 請(qǐng)使用 Fetch 方法取得每條記錄信息
function Query ($query) {
$this-result = @mysql_query($query, $this-id);
if (!$this-result)
{
if ($this-debug)
MySQL_ErrorMsg ("不能執(zhí)行查詢(query): $query");
else
return false;
}
$this-rows = @mysql_num_rows($this-result);
$this-fields = @mysql_num_fields($this-result);
if (!$this-rows) return false;
return true;
}
function QuerySql ($query) {
$ret = @mysql_query($query, $this-id);
if ($ret === false)
{
if ($this-debug)
MySQL_ErrorMsg ("不能執(zhí)行查詢(query): $query");
else
return false;
}
$this-result = $ret;
$this-rows = @mysql_num_rows($this-result);
$this-fields = @mysql_num_fields($this-result);
return true;
}
# 如果查詢結(jié)果為單條記錄時(shí)使用,返回結(jié)果存儲(chǔ)于數(shù)組 data 中
function QueryRow ($query) {
$this-result = @mysql_query($query, $this-id);
if (!$this-result)
{
if ($this-debug)
MySQL_ErrorMsg ("不能執(zhí)行查詢(query): $query");
else
return false;
}
$this-rows = @mysql_num_rows($this-result);
$this-data = @mysql_fetch_array($this-result, MYSQL_ASSOC);
//MySQL_ErrorMsg ("不能從查詢結(jié)果中取得數(shù)據(jù) $query");
if (!$this-result || !$this-rows)
return false;
return true;
}
# 移動(dòng)到指定記錄行,將該行結(jié)果儲(chǔ)存于數(shù)組 data 中
function Fetch ($row) {
if(!@mysql_data_seek($this-result, $row))
//MySQL_ErrorMsg ("不能定位到指定數(shù)據(jù)行 $row");
return false;
$this-data = @mysql_fetch_array($this-result, MYSQL_ASSOC);
//MySQL_ErrorMsg ("不能提取指定數(shù)據(jù)行數(shù)據(jù) $row");
if (!$this-data)
return false;
return true;
}
/* 以下方法將作用于 arows */
/* 此方法將作用于 iid */
function Insert ($query) {
$this-result = @mysql_query($query, $this-id);
if (!$this-result)
{
if ($this-debug)
MySQL_ErrorMsg ("不能執(zhí)行查詢(query): $query");
else
return false;
}
$this-arows = @mysql_affected_rows($this-id);
$this-iid = @mysql_insert_id($this-id);
return true;
}
function Update ($query) {
$this-result = @mysql_query($query, $this-id);
if (!$this-result)
{
if ($this-debug)
MySQL_ErrorMsg ("不能執(zhí)行查詢(query): $query");
else
return false;
}
$this-arows = @mysql_affected_rows($this-id);
if (!$this-arows || $this-arows == -1)
return false;
return true;
}
function Delete ($query) {
$this-result = @mysql_query($query, $this-id);
if (!$this-result)
{
if ($this-debug)
MySQL_ErrorMsg ("不能執(zhí)行查詢(query): $query");
else
return false;
}
$this-arows = @mysql_affected_rows($this-id);
return true;
}
function Error (){
return mysql_error()."(".mysql_errno().")";
}
function Errno (){
return mysql_errno();
}
}
/*
* MySQL_ErrorMsg
* 輸出錯(cuò)誤信息
*/
function MySQL_ErrorMsg ($msg) {
# 關(guān)閉可能影響字符顯示的HTML代碼
echo("/ul/dl/ol\n");
echo("/table/script\n");
# 錯(cuò)誤信息
$text = "font color=\"#000000\" style=\"font-size: 9pt; line-height: 12pt\"p系統(tǒng)提示:".$msg."br";
$text .= "錯(cuò)誤信息:";
$text .= mysql_error()."br";
$text .= "錯(cuò)誤代碼:".mysql_errno()."brbr";
$text .= "請(qǐng)稍候再試,如果問題仍然存在,請(qǐng)與 a href=\"mailto:wuqiong@igenus.org\"系統(tǒng)管理員/a 聯(lián)系!";
$text .= "/font\n";
die($text);
}
}
?
一些細(xì)節(jié)的地方自己修改吧 主要是我在別的文件專門定義了全局變量,你看一遍,把應(yīng)改的地方改一下就好了
文章題目:php寫一個(gè)數(shù)據(jù)庫(kù)管理 php數(shù)據(jù)庫(kù)管理系統(tǒng)
標(biāo)題路徑:http://chinadenli.net/article16/hpecdg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、云服務(wù)器、品牌網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、做網(wǎng)站、虛擬主機(jī)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)