Display TableResults for Public Acces

svkessel 05 Jun, 2008
Hello,

I want to show data done by a query, i followed topic #4145 but i cannot get it to show data already uploaded by document chronoforms_15.

I work with joomla 1.x and the latest Chrono application. The latest mambot is installed to show data by content and this works fine.

This is the code from the document that i need data from:
<?php global $database;
$database->setQuery( "INSERT INTO #__chronoforms_15 VALUES  (
'' , '". date('Y-m-d')." - ".date("H:i:s")."', 
'".$_SERVER['REMOTE_ADDR']."' , 
'".mosGetParam($_POST,'Toernament','')."' , 
'".mosGetParam($_POST,'email','')."' , 
'".mosGetParam($_POST,'Name','')."' , 
'".mosGetParam($_POST,'Firstname','')."' , 
'".mosGetParam($_POST,'Adres','')."' , 
'".mosGetParam($_POST,'Postcode','')."' , 
'".mosGetParam($_POST,'City','')."' , 
'".mosGetParam($_POST,'Telephonenr','')."' , 
'".mosGetParam($_POST,'Mobilenr','')."' , 
'".mosGetParam($_POST,'remarks','')."' , 
'".mosGetParam($_POST,'Submit','')."');" );

if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
This is the code placed i a chrono test document:
<?php 
// initialise the database code 
global $database; 
$sql = "SELECT * FROM #__chronoforms_15;";
$database->setQuery($sql); 
$rows = $database->loadObjectList(); 
echo "<table><tr> <td>Name</td> <td>Emailadres</td> <td>Telephonenr</td></tr>"; 
foreach ( $rows as $record ) { 
  $name = $record->Name." ".$record->Firstname; 
  echo "<tr> <td>".$name."</td> 
    <td>".$record->email."</td> 
    <td>".$record->Telephonenr."</td> </tr>"; 
} 
echo "</table>"; ?>
Please give a comment what is wrong. I want to display the Name,Firstname,email and telephonenr in this listing.

Regards

Sjef
GreyHead 05 Jun, 2008
Hi Sjef,

That looks OK to me. Try putting
echo "record: ";print_r($record);echo"<br />";
into the foreach loop so that you can see what data you have.

Bob
svkessel 05 Jun, 2008
Hello Bob

Thank you for your very fast reply, i put in the code but still no data is shown, only the link to Chronoform.

In the document there a 2 records stored that can be opened with "Show data", so data is present and all fileds are filled.

Code is placed in a dummy document and the code is placed in the Form HTML.
<?php 
// initialise the database code 
global $database; 
$sql = "SELECT * FROM #__chronoforms_15;"; 
$database->setQuery($sql); 
$rows = $database->loadObjectList(); 
echo "<table><tr> <td>Naam</td> <td>Emailadres</td> <td>Telefoon</td></tr>"; 
foreach echo "record: ";print_r($record);echo"<br />";( $rows as $record ) { 
$name = $record->Naam." ".$record->Voornaam; 
echo "<tr> <td>".$name."</td> <td>".$record->email."</td> <td>".$record->Telefoon."</td> </tr>"; 
} 
echo "</table>"; ?>


any idea

regards

Sjef
GreyHead 05 Jun, 2008
Hi sjef,

Sorry, I wasn't specific enough:
<?php  
// initialise the database code  
global $database;  
$sql = "SELECT * FROM #__chronoforms_15;";  
$database->setQuery($sql);  
$rows = $database->loadObjectList();  
echo "<table>
<tr> <td>Naam</td> 
  <td>Emailadres</td> 
  <td>Telefoon</td></tr>";  
foreach ( $rows as $record ) { 
  echo "record: ";print_r($record);echo"<br />"; 
  $name = $record->Naam." ".$record->Voornaam;  
  echo "<tr> <td>".$name."</td> 
    <td>".$record->email."</td> 
    <td>".$record->Telefoon."</td> </tr>";  
}
echo "</table>"; 
?>
This will make a complete mess of the output page but you should be abel to pick out the results to see what is in the $record objects.

Bob
svkessel 17 Jun, 2008
Hello Bob,

Tried what you suggested but strangely i get not data back at all.

Only the Chronoform link is displayed in the empty document.

Is there a way to display all data in the contentpage?

Regards,

Sjef
GreyHead 17 Jun, 2008
Hi Sjef,

What Chronoform link is displayed?

Is this page on-line so I can see it?

Bob
svkessel 17 Jun, 2008
Hello Bob

Link to document to fill data (document #15):
http://bastionbaselaar.nl/joomla/index.php?option=com_chronocontact&chronoformname=midzomernacht

Link to document to display data (displays only the Joomla Professional work link):
http://bastionbaselaar.nl/joomla/index.php?option=com_chronocontact&chronoformname=test

Recorddata filled by the first link (document #15), records are present an can be downloaded by CSV:

Field name Field data
cf_id : 3
recordtime : 2008-06-09 - 15:41:05
ipaddress : 212.203.12.98
Toernooi : Midzomernacht Toernooi zaterdag 21 juni
email : [email]asleegers@test.nl[/email]
Naam : Sleegers
Roepnaam : Anke
Geslacht : Vrouw
Geboortedatum : 07-04-1999
Adres : Vivaldistraat 122
Postcode : 5216 EL
Woonplaats : 's-Hertogenbosch
Telefoonnummer : -
Mobielnummer : 06-299999

Query in Formcode HTML of document test:
<?php
// initialise the database code 
global $database; 
$sql = "SELECT * FROM #__chronoforms_15;";
$database->setQuery($sql); 
$rows = $database->loadObjectList(); 
echo "<table> <tr> <td>Naam</td> <td>Emailadres</td> <td>Telefoon</td></tr>"; 
foreach ( $rows as $record ) { 
echo "record: ";print_r($record);echo"<br />"; 
$name = $record->Naam." ".$record->Roepnaam; 
echo "<tr> <td>".$name."</td> <td>".$record->email."</td> <td>".$record->Telefoonnummer."</td> </tr>"; 
} 
echo "</table>"; 
?>
Hope this data is enough for you.

Regards

Sjef
GreyHead 17 Jun, 2008
Hi Sjef,

Ok - the form is outputting only the form tags but no form html. I don't immediately see why :-(

If it's OK with you I suggest that you send me an admin logon to the site at the email in my sig and I'll logon and take a look.

Bob
GreyHead 18 Jun, 2008
Hi Sjef,

Fixed - there were no line-breaks in the Form HTML so the // comments marker was commenting out nearly all of the code.

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