Forums

Querying a table created in chronoforms

olaeblue 14 Sep, 2011
I want to show in HTML
Andrew, your vote was For

Based on a database query but the code below provides the following HTML

name, your vote was response

I tried loadRow() and same thing

Any ideas??
<?php
    
    $db =& JFactory::getDBO();
    $user = JFactory::getUser();
    $query = "
      SELECT `cf_id`, 'name', 'response'
        FROM `#__chronoforms_data_vote`
        WHERE `cf_user_id` = ".$user->id." ;
    ";
    $db->setQuery($query);
    $result = $db->loadObject();
 ?>

<?php echo $result->name; ?>, your vote was <strong><?php echo $result->response; ?></strong>.
GreyHead 15 Sep, 2011
Hi olaeblue ,

You must use back-ticks `` round column names. Single quotes define text strings in MySQL:
SELECT `cf_id`, `name`, `response`


Bob
This topic is locked and no more replies can be posted.