snickers
I just did that before I came back to this thread.
It fixed the problem.
Now I have a new one. In object mysqlInfo at the end:
class dbConnect {
var $dbLoc = "localhost";
var $dbUser = "xxx_xxx";
var $dbPass = "xxxxxx";
var $dbName = "xxx_xxx";
var $connection;
var $result;
var $items = array();
var $rowCount = 0;
var $serverInfo = array();
function dbConnect(){
$this->connection = $this->connect();
}
function connect(){
if(mysql_connect($this->dbLoc, $this->dbUser, $this->dbPass, $this->dbName)){
$this->connection = mysql_connect($this->dbLoc, $this->dbUser, $this->dbPass, $this->dbName);
return $this->connection;
} else {
return mysql_error();
}
}
function doQuery($sql){
if(!mysql_query($this->$sql)){
return mysql_error();
} else {
return true;
}
}
function doResultQuery($sql){
$this->items = "";
if($sql != ""){
$this->result = mysql_query($sql, $this->connection);
$item = array();
while($item = mysql_fetch_array($this->result)){
$this->items[] = $item;
}
return $this->items;
mysql_free_result($this->result);
} else {
return mysql_error();
}
}
function destroyConnection(){
mysql_close($this->connection);
return true;
}
function numRows($sql){
$this->rowCount = mysql_num_rows($sql, $this->connection);
return $this->rowCount;
}
function mysqlInfo(){
$this->serverInfo = "";
$this->serverInfo[] = mysql_get_server_info($this->connection);
$this->serverInfo[] = mysql_get_proto_info($this->connection);
return $this->serverInfo;
}
}
I try to use it by calling this code below:
$array = array();
$myDb = new dbConnect;
$array = $myDb->mysqlInfo();
print_r($array->serverInfo);
echo "MySQL Server Version: ".$array->serverInfo[0]."<br />";
echo "MySQL Protocol Version: ".$array->serverInfo[1]."<br />";
Why do these all come up blank?
TIA.
-Travis