Jump to content

dbc class


Danny620

Recommended Posts

hi i have just started to learn oop and i was wondring if i am doing a db class corretly

<?php 

class connect {

var $user = '*****';
var $pass = '*****';
var $host = 'localhost';
var $db_name = '*****';

function connect()
{

$dbc = mysqli_connect($this->user,$this->pass,$this->host,$this->db_name);

if (!$dbc) {
return ('Could not connect to MySQL: ' . mysqli_connect_error() );
}else{

return $this->name;
}

}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/173243-dbc-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.