0

I have need some help. i want to insert data into my database but for ip address query not success

$ipaddr = getHostByName(php_uname('n'));

$columns = array('yes', 'no', 'ipadd');

$values = array($yes,$no,$ipaddr);
$query
    ->insert($db->quoteName('#__jkyesno'))
    ->columns($db->quoteName($columns))
    ->values(implode(',', $values))
 ->where('ipadd != '. $ipaddr);

query gives an error

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Derep1991
  • 1
  • 2
  • I disagree with this, the question is specifically about the Joomla query API. However it is potentially a "debug my code" question. Try doing `echo $query->dump();` and see what the generated query is. This will help you identify where the problem is. – Elin May 12 '15 at 23:47
  • try using this $query ->insert($db->quoteName('#__jkyesno')) ->columns($db->quoteName($columns)) ->values(implode(',', $values)) ->where('ipadd != '. $db->qn($ipaddr)); – Priya Bose May 16 '15 at 18:51
  • Try quote rather than qn for the last clause, – Elin May 17 '15 at 17:16

0 Answers0