MY custom database, is getting data from a form, and is inserted when the consumer reach a certain page. I can't make it any other way (because of reasons)
the page is an easy access page, and people (and bots) can reach it easy. It result of a lot of empty rows in my table, and I want to write a code that delete all empty row, each time they reach the that page.
When I'm inserting the data I use below code:
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO mage_emailorder (emailorder_id, order_date, product_name, location, date_for, name_title, email, company, adress, zipcode, city, phone, ean, comment, order_done, number_of_entries)
VALUES (NULL, '$newdate', '$conferance_name', '$hotel', '$datefor', '$ogtitel', '$email', '$virksomhed', '$adresse', '$postnr', '$by', '$telefon', '$ean', '$kommentarer', '0', '$entries')";
try {
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$conn->query($sql);
} catch (Exception $e){
echo $e->getMessage();
}
the deleting code
$sql2 = "DELETE FROM mage_emailorder WHERE product_name IS NULL;"
try {
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$conn->query($sql2);
} catch (Exception $e){
echo $e->getMessage();
}
?>
My code for deleting is giving me error in the try{ }catch(){}
, can some one help me with why?