Forums

PHP errors

olaeblue 22 Jan, 2012
I am trying to build a kml creator based on google code one.

I have a table called #_huts with 2 records in (fileds are id (INT autoinc), name (VCHAR), description (TEXT with CData in), Lat etc etc
but when I run even the simples query
<?php

$db =& JFactory::getDBO();

// Selects all the rows in the markers table.
$query = 'SELECT * FROM `#_huts` WHERE 1';

$db->setQuery($query);
$results=$db->loadObjectList();

foreach ($results as $result):

echo $result->name;

endforeach;

?>


Warning: Invalid argument supplied for foreach() in /homepages/11/d369608199/htdocs/yrcweb/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(18) : eval()'d code on line 9

Any idea what I'm doing wrong? This same (syntax) code works in other places??
Max_admin 22 Jan, 2012
You should have 2 underscores after the the "#" sign in the table name:#__

Cheers,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.