Colin Arenburg
New member
Hello Guys and Gals, i have just started to dive into OOP. I am stuck on how to insert into a database with OOP this is what i have so far. What i would like to do is have the fields taken from the form ( also not one hundred percent sure how to do that.
I have a class that creates a forum based on code somthing like this:
if that helps any, not sure it well
PHP:
class DataBase {
private $dbhost = 'localhost';
private $dbuser = 'ct';
private $dbpass = 'XVXVXVXVXVX(not the password :P)';
private $db = 'flockmanager';
private $fields = array();
private $col = $_POST['column']
function connect()
{
$connect = mysql_connect($this->dbhost,$this->dbuser, $this->dbhost)
if (!$connect)
{
print '<p class="dbError">We are sorry there was an error connecting to the database the error was:'mysql_error'</p>';
}
}
function insert() {
$connect
$query = 'INSERT INTO'.$this->column.()
)
}
}
?>
I have a class that creates a forum based on code somthing like this:
PHP:
$myform = new Form("action","submitButtonText","submitButtonClass","formClass","meathod","Column");
$myform->addField("fieldName","label","type");
if that helps any, not sure it well