mySQL private/conn issues
I'm having some issues with a 1&1 account a client of mine is hosted with. I'm getting errors on lines 2 & 20 (denoted as bold below), which doesn't make sense as they're basic php functions.
I've used this same script dozens of times with no issues, until putting it on this 1&1 account. Is anyone seeing something I may be missing?
class Mysql {
private $conn;
function __construct() { $this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database.'); }
function verify_Username_and_Pass($un, $pwd) {
$query = "SELECT * FROM users WHERE username = ? AND password = ? LIMIT 1";
if($stmt = $this->conn->prepare($query)) { $stmt->bind_param('ss', $un, $pwd); $stmt->execute();
Thanks in advance!
EDIT:
thanks pinkgothic for reminding me to put the errors on here >.<
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/24/d100728/htdocs/members/classes/Mysql.php on line 6
^thats for the private class
Fatal error: Call to a member function on a non-object in /homepages/24/d100728/htdocs/members/classes/Mysql.php on line 20
^when the private line is commented out, im able to reach the login screen but get this error on submission.
Also, the database is running MySQL5.0.
如果它在私有变量声明上失败,那么它可能会运行PHP 4,因为没有办法让私有类属性直到PHP 5。
链接地址: http://www.djcxy.com/p/93786.html上一篇: 如何在高级查询中使用PDO进行准备语句?
下一篇: mySQL私人/ conn问题