I'm not gonna lie, this is my first crack at writing classes and stuff. But for the life of me, I cannot figure out why this isn't working. The class in question is for dedicated server information, it contains variables describing the server, and functions for creating, altering, and viewing the information. I have a page that SHOULD add a server into the database, but it isn't working. Code follows:
function create($label, $customername, $customerphone, $email, $racknum,
$ipaddresses, $accessinfo, $monitor, $os, $addsoft, $type,
$mrtg, $backup, $pridns, $secdns, $purpose, $setup, $datesetup,
$qrr, $fee, $psa, $psanotes)
{
// Populates the object with information for a new dedicated server
// then calls function to insert info into database
$this->m_label = $label;
$this->m_customername = $customername;
$this->m_customerphone = $customerphone;
$this->m_email = $email;
$this->m_racknum = $racknum;
$this->m_ipaddresses = $ipaddresses;
$this->m_accessinfo = $accessinfo;
$this->m_monitor = $monitor;
$this->m_os = $os;
$this->m_addsoft = $addsoft;
$this->m_type = $type;
$this->m_mrtg = $mrtg;
$this->m_backup = $backup;
$this->m_pridns = $pridns;
$this->m_secdns = $secdns;
$this->m_purpose = $purpose;
$this->m_setup = $setup;
$this->m_datesetup = $datesetup;
$this->m_qrr = $qrr;
$this->m_fee = $fee;
$this->m_psa = $psa;
$this->m_psanotes = $psanotes;
$this->savenew();
}
function savenew()
{
// Function inserts new entry into the database and grabs the id
addslashes($this->m_label);
addslashes($this->m_customername);
addslashes($this->m_customerphone);
addslashes($this->m_email);
addslashes($this->m_racknum);
addslashes($this->m_ipaddresses);
addslashes($this->m_accessinfo);
addslashes($this->m_monitor);
addslashes($this->m_os);
addslashes($this->m_addsoft);
addslashes($this->m_type);
addslashes($this->m_mrtg);
addslashes($this->m_backup);
addslashes($this->m_pridns);
addslashes($this->m_secdns);
addslashes($this->m_purpose);
addslashes($this->m_setup);
addslashes($this->m_datesetup);
addslashes($this->m_qrr);
addslashes($this->m_fee);
addslashes($this->m_psa);
addslashes($this->m_psanotes);
$dbstatement = "insert into dedicated (label, customername,
customerphone, email, racknum, ipaddresses, accessinfo,
monitor, os, addsoft, type, mrtg, backup, pridns, secdns,
purpose, setup, datesetup, qrr, fee, psa, psanotes) values
('$this->m_label', '$this->m_customername',
'$this->m_customerphone', '$this->m_email', '$this->m_racknum',
'$this->m_ipaddresses', '$this->m_accessinfo', '$this->m_monitor', '$this->m_os',
'$this->m_addsoft', '$this->m_type', '$this->m_mrtg',
'$this->m_backup', '$this->m_pridns', '$this->m_secdns',
'$this->m_purpose', '$this->m_setup', '$this->m_datesetup',
'$this->m_qrr', '$this->m_fee', '$this->m_psa', '$this->m_psanotes')";
echo $dbstatement;
$dbaction = mysql_query($dbstatement);
$querystatement = "select serverid from dedicated where label = $this->m_label";
$queryaction = mysql_query($querystatement);
$this->m_serverid = mysql_result($queryaction, 0, "serverid");
stripslashes($this->m_label);
stripslashes($this->m_customername);
stripslashes($this->m_customerphone);
stripslashes($this->m_email);
stripslashes($this->m_racknum);
stripslashes($this->m_ipaddresses);
stripslashes($this->m_accessinfo);
stripslashes($this->m_monitor);
stripslashes($this->m_os);
stripslashes($this->m_addsoft);
stripslashes($this->m_type);
stripslashes($this->m_mrtg);
stripslashes($this->m_backup);
stripslashes($this->m_pridns);
stripslashes($this->m_secdns);
stripslashes($this->m_purpose);
stripslashes($this->m_setup);
stripslashes($this->m_datesetup);
stripslashes($this->m_qrr);
stripslashes($this->m_fee);
stripslashes($this->m_psa);
stripslashes($this->m_psanotes);
}
Unfortunately, the data never gets entered into the database. I'm echoing the insert string to the browser for debugging purposes, and I can cut-n-paste the displayed string straight into a mysql console and the insert goes without a hitch. What am I missing?