Forums

Custom table

federcla 17 Oct, 2012
good morning,
i need a help, i should do a report with the data in a table, and i would like that the records would be editable in another form, with a click in a link or in a image

i have create a form and i have insert in actions the Custom Code


<?php
  $db =& JFactory::getDBO();
  $query =  "SELECT mese, assistenza_tecnica, riparazioni, canoni_software, hardaware  
                FROM sks_app_budget_ict 
                  ORDER BY cod_mese ASC";
  $db->setQuery($query);
  $row = $db->loadRowList();  
  
  echo '<table width=100%><tr bgcolor=dbdbdb height=22><th>Mese</th><th>Assistenza Tecnica</th><th>Riparazioni</th><th>Canoni Software</th><th>Hardware</th></tr>';
  foreach ($row as $key1=>$rw) {
          echo '<tr>';
    	     foreach ($rw as $key2=>$r) {
            echo '<td width=30% height=22>' .$r. '</td>';
      	
        }
        echo '</tr>';
      }
      echo '</table>';
  
?>

but don't work?

really I should do another type of query


$query =  "SELECT cf_id, anno, mese, assistenza_tecnica, riparazioni, canoni_software, hardaware  
                FROM sks_app_budget_ict 
                  ORDER BY cod_mese ASC"


because i have need of cf_id for attached the modify form

can you help me?
federcla 17 Oct, 2012
I have try this code, but nothing, it's doesn't work!


<?php
  $db =& JFactory::getDBO();
  $query =  "SELECT cf_id, anno, mese, assistenza_tecnica, riparazioni, canoni_software, hardaware  
                FROM sks_app_budget_ict 
                  ORDER BY cod_mese ASC";
  $db->setQuery($query);
  $row = $db->loadRowList();
  
  echo $row['0']['4'];
  
?>
GreyHead 17 Oct, 2012
Hi federcla,

This looks OK from here. Try copying and pasting the query into PHP MyAdmin and see if you get any errors shown up there.

Bob

PS You can also do this with the DB Multi Record Loader action.



Bob
federcla 18 Oct, 2012
Yes is ok, now it work, i think that when i have copy the code from my IDE in custom code of ChronoForms there was an codec error that I did not see

PS. Yes i know that i can use the DB Multi Record Loader action, but i don't know if it is good for my system.
i must do a query with 6 fields, but 2 must be hidden, this because i must use this fields for do research in a another form for modify the data

i don't know if is possible with DB Multi Record Loader action

Yesterday i have buy this book, ChronoForms 3.1 for Joomla! site Cookbook, i want study better this module for joomla🙂
This topic is locked and no more replies can be posted.