Forums

JTable & joomla

yuki 22 Mar, 2012
Hi,
I use this code for delete a rows in a table but no result :s

<?php
jimport( 'joomla.database.table' );
$db =& JFactory::getDBO();
$table = $db->getTable('MyTable');
$table->delete($id);
?>

someone help me ^^
GreyHead 22 Mar, 2012
Hi yuki,

Do you want to delete the whole table or just selected records from the table?

To delete selected records it would be
<?php
$db =& JFactory::getDBO();
$query = "
    DELETE
        FROM `#__some_table`
        WHERE `column_name` = 'value' ;
";
$db->setQuery($query);
$db->query();
?>

Bob
yuki 25 Mar, 2012
Hi,
Yeees :mrgreen: thank youuu :wink:
This topic is locked and no more replies can be posted.