Forums

How do I convert the string?

Skiverens 08 Apr, 2010
How do I convert the string?
In Chrono Conectivity I want to make a list of my table “#__chronoforms_driftsmiddel”.
In that list I want to grab some information from another table named “#__chronoforms_doc” where the dmnr have equal value.
But is don’t work.
I recognized that there is a difference between the value in {dmnr} and $dmn="0062000019"; If I remove the remarks, and replace the value with a known string it is working the right way. I investigated the string $dmn=('{dmnr}'); and found the strlng($dmn=('{dmnr}'); is 6 although the displayed the same value: 0062000019.
So… How do I convert the value from the pointer {dmnr} to a real string?
I have also tried $query = sprinf(…… but it’s the same result!

 <tr >
        <td>{dmnr}</td> <td>{navn}</td> <td>{serienr}</td> <td><?php
          

          $dmn=('{dmnr}');
           /* echo $dmn;                                         /*  0062000019  */ 
               $dmn="0062000019";
               echo $dmn; */                                     /*  0062000019  */
 
          $db =& JFactory::getDBO();
          $query = " SELECT * FROM #__chronoforms_doc WHERE dmnr = $db->Quote($dmn)";

          $db->setQuery($query);

          $rows = $db->loadObjectList();
          foreach ($rows as $row) {
             $bevis= $row->bevis;
}          
            echo $bevis;
 
         ?></td> <td></td> <td>{godkinit}</td> <td>{eftersyndato}</td>{edit_record}{delete_record} 
  </tr>
</table>
GreyHead 09 Apr, 2010
Hi Skiverens,

As far as I know you can't do a MySQL query from the ChronoConnectivity body box. It's already running inside a query loop and the second query corrupts the results from the first.

I believe that it is possible to create a temporary MySQL table that merges the values from both then run the main MySQL query against that but I haven't done it. (I think that someone posted that they had done so a month or so ago.)

Bob
Skiverens 09 Apr, 2010
I don’t think the problem is the sql query, because it work well if I overwrite $dmn with the known value “0062000019”. It is converting {dmnr} to a string I can’t do. And sprint do also not functioning.
This topic is locked and no more replies can be posted.