I'm not the best with OOP concepts but I am trying to learn. I have a MySQL Connection class which also has a query function in it. I have a simple form and I just want the data entered into the database. Records are being added to the database however not the actual information from the forms. Any help would be appreciated.
//MySQL query function:
function query($sql)
{
$query = mysql_query($sql, $this->db);
return $query;
}
// submit function (different class):
function submitInvoice()
{
$connection = new mysqlConnection();
$connection->connect();
if($_POST['submit'] == "Submit")
{
$qry = $connection->query("INSERT INTO invoices (id, date, item, ownership, amount) VALUES('', NOW(), '$this->item', '$this->ownership', '$this->amount')") or die(mysql_errno().' : '.mysql_error());
if ($qry)
{
echo($qry . "<br />");
echo("Invoice added.");
} else {
echo("Error adding invoice.");
}
}
}
I have the echo($qry) bit in there to see what the query is echo'ing out, and the only thing that it puts out is '1' and 'Invoice added'.