I have created a form and included this code to call the user information-
It's pulling the data correctly, but it's including the database numbers (example)-
6 6 78 1409 South Lamar Street
7 7 78 Dallas
8 4 78 Texas
9 8 78 75215
10 5 78 USA
11 9 78 214-111-2222
How can I remove the numbers and replace them with the field names (example)-
Street: 1409 South Lamar Street
City: Dallas
State: Texas
Zip Code: 75215
Country: USA
Phone: 214-111-2222
Thanks in advance. On another note, I've only been playing around with this a few hours, but it has to be one of the best Joomla components I've come across. EXCELLENT work. I'll definately vote and buy.
<?php
$database = &JFactory::getDBO(); // only needed once
$user = JFactory::getuser();
$query = "SELECT * FROM jos_juser_extended_data
WHERE user_id='".$user->id."' ";
$database->setQuery( $query );
$rows = $database->loadObjectList();
//$count = $database->getNumRows();
//echo "count: $count<br />";
echo "<table>";
foreach ($rows as $row) {
echo "<tr>";
foreach ($row as $value) {
echo '<td>' .$value .'</td>';
}
echo "</tr>";
}
echo "</table>";?>It's pulling the data correctly, but it's including the database numbers (example)-
6 6 78 1409 South Lamar Street
7 7 78 Dallas
8 4 78 Texas
9 8 78 75215
10 5 78 USA
11 9 78 214-111-2222
How can I remove the numbers and replace them with the field names (example)-
Street: 1409 South Lamar Street
City: Dallas
State: Texas
Zip Code: 75215
Country: USA
Phone: 214-111-2222
Thanks in advance. On another note, I've only been playing around with this a few hours, but it has to be one of the best Joomla components I've come across. EXCELLENT work. I'll definately vote and buy.
Hi LM360,
It looks as though it's doing exactly what you've asked it to do. (But then computers are like that.) Hard to tell what you really want without seeing the database query results but probably something like:
Bob
It looks as though it's doing exactly what you've asked it to do. (But then computers are like that.) Hard to tell what you really want without seeing the database query results but probably something like:
foreach ($rows as $row) {
echo "<tr>";
echo "<td>City</td><td>".row->city."</td>";
echo "<td>Phone</td><td>".row->phone."</td>";
. . .
echo "</tr>";}Bob
Hi Bob,
Thank you for your quick response. These are the database query results from the code above-
6 6 78 1409 South Lamar Street
7 7 78 Dallas
8 4 78 Texas
9 8 78 75215
10 5 78 USA
11 9 78 214-111-2222
I have tried the adding the echo's as suggested, but I am getting and error-
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /homepages/18/d290018641/htdocs/components/com_chronocontact/plugins/cf_profile.php(206) : eval()'d code on line 14
Am I missing a closing tag somewhere? Here is the code I'm using-
Thank you so much for your help!
Michael
Thank you for your quick response. These are the database query results from the code above-
6 6 78 1409 South Lamar Street
7 7 78 Dallas
8 4 78 Texas
9 8 78 75215
10 5 78 USA
11 9 78 214-111-2222
I have tried the adding the echo's as suggested, but I am getting and error-
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /homepages/18/d290018641/htdocs/components/com_chronocontact/plugins/cf_profile.php(206) : eval()'d code on line 14
Am I missing a closing tag somewhere? Here is the code I'm using-
<?php
$database = &JFactory::getDBO(); // only needed once
$user = JFactory::getuser();
$query = "SELECT * FROM jos_juser_extended_data
WHERE user_id='".$user->id."' ";
$database->setQuery( $query );
$rows = $database->loadObjectList();
// $count = $database->getNumRows();
// echo "count: $count<br />";
echo "<table>";
foreach ($rows as $row) {
echo "<tr>";
foreach ($row as $value) {
echo "<td>Street</td><td>".row->street."</td>";
echo "<td>City</td><td>".row->city."</td>";
echo "<td>State</td><td>".row->state."</td>";
echo "<td>Zip Code</td><td>".row->zipCode."</td>";
echo "<td>Country</td><td>".row->country."</td>";
echo "<td>Phone</td><td>".row->phoneNumber."</td>";
}
echo "</tr>";
}
echo "</table>";?>Thank you so much for your help!
Michael
This topic is locked and no more replies can be posted.
