OK... here's what I have so far...
Code: Select all
<?php
include_once("../includes/functions.php");
class pDirect{
var $id;
var $name;
var $description;
var $address;
var $city;
var $state;
var $zip;
var $phone;
var $email;
var $website;
var $st_hosted;
var $categories;
var $misc;
var $host;
var $user;
var $pass;
var $dbas;
function pDirect(){
$this->host = "host";
$this->user = "user";
$this->pass = "pass";
$this->dbas = "directory";
if(mysql_connect($this->host, $this->user, $this->pass)){
if(!mysql_select_db($this->dbas){
logerror("Could not select database: ".$this->dbas." MySQL Says: ".mysql_error());
}
}
else{
logerror("Could not connect to database with user: ".$this->user." MySQL Says: ".mysql_error());
}
}
function addDb(){
$sql = "INSERT INTO ".$this->dbas." VALUES('".$this->id."', '".$this->name."', '".$this->description."', '".$this->address."', '".$this->city."', '".$this->state."', '".$this->zip."', '".$this->phone."', '".$this->email."', '".$this->website."', '".$this->st_hosted."', '".$this->categories."', '".$this->misc."')";
if(mysql_query($sql)){
return true;
}
logerror("Could not execute query: ".$sql." Mysql Says: ".mysql_query());
return false;
}
function delDb(){
$sql = "DELETE FROM ".$this->dbas." WHERE `id` = '".$this->id."'";
if(mysql_query($sql)){
return true;
}
logerror("Could not execute query: ".$sql." Mysql Says: ".mysql_query());
return false;
}
}
?>Is there a standard way to set variables (since I am setting up a web interface that will accept these values from a form and send them to this class).