|
|
<?php
include('conn_db.php');
$database='fyp00';
$mysqli=new mysqli($host,$user,$password,$database);
if(mysqli_connect_errno()){
echo mysqli_connect_error();
exit();
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" c>
</head>
<body>
<form name='update_pw' action='' method='post'>
Username: <input type='text' name='username_urs' /><br />
Password: <input type='password' name='old_pw_urs' /><br />
New PW: <input type='password' name='new_pw1_urs' /><br />
Confirm New PW: <input type='password' name='new_pw2_urs' /><br />
<input type='submit' name='submit' value='Change it!' />
</form>
<?php
if (isset($_POST['submit'])) {
$invalid = false;
foreach ($_POST as $key => $value) {
if (empty($value)) {
$invalid = true;
}
}
if ($invalid) {
echo "<p>You must fill in all fields!</p>\n";
} else {
if ($_POST['new_pw1_urs'] != $_POST['new_pw2_urs']) {
echo "<p>New Passwords do not match!</p>\n";
} else {
$query = mysql_query("select * from staff wherestaffid='".$_POST['username_urs']."' andpassword=PASSWORD('".$_POST['old_pw_urs']."')");
if (mysql_num_rows($query) > 0) {
echo "<p>Invalid username/password combination!</p>\n";
} else {
if (mysql_query("UPDATE staff SET password =password('".$_POST['new_pw1_urs']."') WHERE staffid ='$_POST[username_urs]'")) {
echo "<p>Password updated!</p>\n";
} else {
echo "<p>Couldn't update password!</p>\n";
}
}
}
}
}
?>
</body>
</html>
Warning:mysql_query() [function.mysql-query]: Access denied for user'ODBC'@'localhost' (using password: NO) in C:\www\pass.php on line 42
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\www\pass.php on line 42
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\www\pass.php on line 43
Warning:mysql_query() [function.mysql-query]: Access denied for user'ODBC'@'localhost' (using password: NO) in C:\www\pass.php on line 46
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\www\pass.php on line 46
Couldn't update password!
为什么会有以上的error的?救救我!!:'(:'(:'(:'( |
|
|
|
|
|
|
|
|
|
|
发表于 16-11-2008 05:20 PM
|
显示全部楼层
做么你酱用的?
你好像connect到MySQLLite。
把这边
<?php
include('conn_db.php');
$database='fyp00';
$mysqli=new mysqli($host,$user,$password,$database);
if(mysqli_connect_errno()){
echo mysqli_connect_error();
exit();
}
改成
<?php
include('conn_db.php');
$database='fyp00';
$conn = mysql_connect($host, $user, $password) ;
if(!$conn){
echo mysql_error();
exit;
}
mysql_select_db($database); |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 16-11-2008 05:26 PM
|
显示全部楼层
MySQLLite是什么意思?
我本身是新手!
我解决我的问题了! |
|
|
|
|
|
|
|
|
|
|
发表于 16-11-2008 05:35 PM
|
显示全部楼层
原帖由 ahjing 于 16-11-2008 05:26 PM 发表 
MySQLLite是什么意思?
我本身是新手!
我解决我的问题了!
其实MySQLi 不是MySQL Lite,而是MySQL, Improved。(我刚刚讲错了,抱歉)
是PHP中新的MySQL链接方法。我没用过。。一直都是用MySQL而已。 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|