I think the problem lies in this function:
Code: Select all
function duplicate($cid) {
if (is_numeric($cid) && $cid>0) {
JArrayHelper::toInteger($cid);
$query = "SELECT * FROM #__rdautos_information WHERE carid=$cid LIMIT 1";
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$rowKeys = array_keys($row);
$rowValues = array_values($row);
$sql = "INSERT INTO #__rdautos_information SET ";
for ($i=3; $i<count($rowKeys); $i+=2) {
if ($i!=3) {$sql .= ", ";}
$sql .= $rowKeys[$i]." = '".$rowValues[$i]."'";
}
$this->_db->setQuery( $sql );
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
return true;
}Is anyone familiar with how Joomla communicates with the database?
Thanks, Ben