[請益] 資料庫連結有問題
請問...
這個是後台的網頁,是將前台頁的資料存到資料庫裡面
可是她都會顯示Fatal error: Call to undefined function create_connection() in
C:\AppServ\www\sheetB.php on line 16
可是我自己找不出錯誤 請各位幫幫忙@@
---------------以下是程式碼--------------
<?php
$db_connect=mysql_connect('localhost', 'root', '123')or die("Could not
connect : " . mysql_error());
mysql_query("set names utf8");
mysql_select_db('computer');
//取得 sheetA.php 網頁的表單資料
$tb_class = $_POST["tb_class"];
$tb_account = $_POST["tb_account"];
$tb_name = $_POST["tb_name"];
$tb_classname = $_POST["tb_classname"];
$tb_category = $_POST["tb_category"];
$tb_past = $_POST["tb_past"];
$tb_date = $_POST["tb_date"];
//建立資料連接
$link = create_connection(); <======這行!!!
$db_selected = mysql_select_db('computer', $link)or die("開啟資料庫失敗
<br><br>" . mysql_error($link));
//執行 SQL 命令,新增
$sql = "INSERT INTO sheet (tb_class, tb_account, tb_name, tb_classname,
tb_category, tb_past, tb_date) VALUES ('$tb_class', '$tb_account','$tb_name',
'$tb_classname', '$tb_category','$tb_past','$tb_date')";
$result = execute_sql("computer", $sql, $link);
//關閉資料連接
mysql_close($link);
?>
<html>
<head>
<title>登錄假單成功</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<center>
<p><font face="標楷體" size="7">智慧校園</font> </p>
<hr>
<p> <br>
<font size="5" face="標楷體">請假登錄</font></p>
<p><br>
恭喜您已經登錄資料成功了。</p>
<p>
</p>
<p><a href="http://localhost/登入後功能畫面-職員.html">回首頁</a></p>
</center>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.121.155.67
→
11/01 15:49, , 1F
11/01 15:49, 1F
→
11/01 20:49, , 2F
11/01 20:49, 2F
→
11/01 20:50, , 3F
11/01 20:50, 3F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章