The only changes recently is the host changed the php global version from php4.2 to php5.4 and I changed the .htaccess from php5 to php6.
Weedpacket replied earlier saying:
PHP:
/**
* construct method
* set or init database info
* @param $dbConn
*/
function __construct($dbConn){
---------
You're not supplying this info. See:
PHP:
[code=php]$db_conn = new Db_conn();[/code]
Have not finish reading all my php books. I just don't know what to do to fix it. If you run out your patient and do not reply i understand, but if you or somebody can help, I am very grateful.
The defined file - db_conn.php copied below:
<?php
class Db_conn{
var $mysql_server_name="xxxxxxxxxx"; //database server name
var $mysql_username="xxxxxxxxx"; // database username
var $mysql_password="xxxxxxxxx"; // database password
// var $mysql_server_name="xxxxxxxx"; //database server name
// var $mysql_username="xxxxxx"; // database username
// var $mysql_password="xxxxxx"; // database password
var $mysql_database="xxxxxxxxx"; // database name
var $conn; // connection
var $result; // database resource
/**
* construct method
* set or init database info
* @param $dbConn
*/
function __construct($dbConn){
if(!empty($dbConn["mysql_server_name"]))
$this->mysql_server_name = $dbConn["mysql_server_name"];
[/QUOTE] if(!empty($dbConn["mysql_username"]))
$this->mysql_username = $dbConn["mysql_username"];
if(!empty($dbConn["mysql_password"]))
$this->mysql_password = $dbConn["mysql_password"];
if(!empty($dbConn["mysql_database"]))
$this->mysql_database = $dbConn["mysql_database"];
}
function Db_conn($dbConn){
}
/**
* open connection
* select database
*/
function open_conn(){
$this->conn=mysql_connect($this->mysql_server_name, $this->mysql_username,$this->mysql_password);
mysql_select_db($this->mysql_database, $this->conn);
}
/**
* free resource
* @param $result
*/
function free_result($result){
mysql_free_result($result);
}
/**
* close the connection
*/
function close_conn(){
mysql_close($this->conn);
}
/**
* execute query
* @param $queryStr
* @return database resource
*/
function query_db($queryStr){
//if error say error..
if (!$this->conn) {
die('Could not connect: ' . mysql_error());
}
$result = mysql_query($queryStr,$this->conn);
if(!$result){
die('mysql error :'.mysql_error());
}
//echo $queryStr."<br/>";
//var_dump($result);
return $result;
}
/**
* search by str
* @param $str
* @param $key
* @return result list of search
*/
function search_by_str($str,$key,$is_array){
//echo $str."<br/>";
$result = $this->query_db($str);
$list = array();
while($row=mysql_fetch_array($result)){
if($row[$key])
if($is_array)
$list[$row[$key]][] = $row;
else
$list[$row[$key]] = $row;
else
$list[] = $row;
}
$this->free_result($result);
return $list;
}
/**
* add modify delete by str
*
* @param $str
*/
function execute_by_str($str){
$result = $this->query_db($str);
$this->free_result($result);
}
/**
* get the last insert id number
* @return last insert id
*/
function get_last_id(){
$id = mysql_insert_id();
return $id;
}
/**
* get count
* @param $table_name
* @return table count
*/
function get_count($table_name,$param=""){
$sql = "select count(*) from `$table_name`";
if(!empty($param))
$sql .= $param;
$list = $this->search_by_str($sql);
return pos(pos($list));
}
}
?>