GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


joomla:write_to_the_database_using_database
    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    $columns = array('TIMESTAMP', 'USERIP', 'DOMAIN', 'ARTICLE','AUDIT','HTML');
 
    $values = array('NOW()', $db->quote(getRealIpAddr()), $db->quote($domain), $db->quote($article), $db->quote($audit), $db->quote($htmltext));
    $query
    ->insert($db->quoteName('#__dnstool'))
    ->columns($db->quoteName($columns))
    ->values(implode(',', $values));
 
    $db->setQuery($query);
    $db->execute();

$columns is an array of column names, $values is the corresponding array of values. Use $db→quote() to get rid of any reserved characters and prevent sql injection attacks

/data/webs/external/dokuwiki/data/pages/joomla/write_to_the_database_using_database.txt · Last modified: 2019/05/20 10:12 by genadmin

Was this page helpful?-12+1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki