php - Joomla insert not working without database prefix -
i'm trying add vale db in joomla
$db = jfactory::getdbo(); $query = $db->getquery(true); // not working $query = "insert `#__devprofile` (`name`) values ('bnar')"; $db->setquery($query); echo "execute"; $db->execute();
but when put db prefix in front of insert
statement works expected this
$query = "insert `hhygd_devprofile` (`name`) values ('bar')";
what missing here?
thanks in advance
* update *
the issue reinstalled joomla ago, wrong database prefix set in configuration.php
, works charm
* *
you have magic quotes gpc off in joomla. requirement joomla installation. can change code better joomla format
$db = jfactory::getdbo(); $query = $db->getquery(true); $columns = array('name'); $values = array($db->quote('bnar')); $query ->insert($db->quotename('#__devprofile')) ->columns($db->quotename($columns)) ->values(implode(',', $values)); $db->setquery($query); $db->execute();
Comments
Post a Comment