Forums

DB Multi Record Loader - Using a PHP Function

the_fitz 03 Aug, 2012
Hi Bob,

Ive got my DB Multi Record Loader form working ok. This is my issue...

One column is a "type" and the Type is stored in the database table as a single letter. I another program (outside of Joomla) that uses that same table I use a function to convert the single letter to a phrase that is more readable to the user. Like....


..............segment..............
while($rowl = mysql_fetch_assoc($lh)){
 $tran_type = $rowl['tran_type'];
 $tran_type_text = get_type($tran_type);
 $tran_date = $rowl['tran_date'];
 $tran_date_us = date("m/d/Y h:i:s.a T",strtotime($tran_date));
   ?>
   <tr>
      <td align="center"><?php echo $tran_date_us?></td>
      <td><?php echo $rowl['tran_store'] ?></td>
      <td align="right">$<?php echo $rowl['tran_d_amt'] ?></td>
      <td align="right"><?php echo round($rowl['tran_p_amt']) ?>  Points </td>
      <td><?php echo $tran_type_text ?></td>
....................................
............function................
function get_type($in_type){
		switch ($in_type)
		{
		case 'D':
		$in_type = 'Blah Blah';
		break;
		case 'A':
		$in_type = 'Arf Arf';
		break;
		case 'P':
		$in_type = 'beep beep';
		break;
		default:
		$in_type = 'Unknown type';
		}
		return($in_type);
		}
.........................................	


Is there a way to do this?

Thanks
MrFitz
Max_admin 04 Aug, 2012
Hi MrFitz,

You will need to use the data under the $form->data array, you can check the data structure using a "Debugger" action, then modify the data using a "Custom code" action, but this will not work with the auto data displayer included in the DBMRL.

Regards,
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.