我想将密码插入数据库现有字段。但这显示错误..
<?php
include './DB_Connection/connection.php';
//some code
$sql = mysql_query("UPDATE user_info SET password = '$password' WHERE company_name='$company_name' AND email = '$email' ");
$result = $db->query($sql);
echo 'out';
if ($result) {//some cose
}
?>
致命错误:在非对象中调用成员函数query() 第23行的“path”\ password_generation.php
第23行是:$result = $db->query($sql);
答案 0 :(得分:2)
<?php
include './DB_Connection/connection.php';
//some code
$sql = "UPDATE user_info ". "SET password = $password ".
"WHERE company_name = $company_name AND email= $email";
$result= mysql_query($sql)
// $result = $db->query($sql);
echo 'out';
if ($result) {//some cose
}
?>
答案 1 :(得分:0)
删除&#39; mysql_query&#39;函数,$ db-&gt; query()应该得到一个字符串。 并且在5.5
中已经弃用了mysql_query