Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Panel: parse error & how to sort alphabetical on user_name

Asked Modified Viewed 1,803 times
H
helmuth
H
Danish translator of PHP-Fusion helmuth@php-fusion.dk
-----------------------------------------
All people are born alike - except Republicans and Democrats. (Groucho Marx)
Listen to the music... https://soundcloud.com/helmuth-mikkel...mikkelsen/
  • Senior Member, joined since
  • Contributed 706 posts on the community forums.
  • Started 219 threads in the forums
  • Started this discussions
  • Answered 1 question
asked
Senior Member

The code below produces this error when activated as panel - it shows in admin area (see attached image):

Quote

Parse error: syntax error, unexpected '<' in /home/helmuth/joyfulchoir.dk/includes/classes/PHPFusion/Panels.inc(313) : eval()'d code on line 1


How to get ridd of this error?

And how do I sort the list alphabetically?

<?php
 
 $result = dbquery(
 "SELECT user_id as user_id, user_name, user_email, user_phone_mobile, user_phone_home, user_geo
 FROM fusion184Ny_users
 WHERE user_status = 0"
 );
 
 if (dbrows($result)) {
while ($data = dbarray($result)) {
echo "<div class='list-group-item'> ";
echo "Navn: <strong>"; echo $data["user_name"]; echo "</strong><br/> ";
echo "Mail: <strong><i>"; echo $data["user_email"]; echo "</i></strong><br/> ";
echo "Mobil: <strong>"; echo $data["user_phone_mobile"]; echo "</strong><br/> ";
echo "Tlf.: <strong>"; echo $data["user_phone_home"]; echo "</strong><br/>";
echo "Adresse: <strong>"; echo $data["user_geo"]; echo "</strong><br/>";
echo "</div>";
 }
 } else {
 echo "No data in table.";
 }
?>
helmuth attached the following file:
mail-phone.png [No information available / 113 Downloads]
0 replies

6 posts

C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

your echo statement is kinda off... reformat it like this

echo “<div>label</div> “.$data[‘user_name’].” “;

2. WHERE user_status=0 ORDER BY user_name ASC
0 replies
H
helmuth
H
Danish translator of PHP-Fusion helmuth@php-fusion.dk
-----------------------------------------
All people are born alike - except Republicans and Democrats. (Groucho Marx)
Listen to the music... https://soundcloud.com/helmuth-mikkel...mikkelsen/
  • Senior Member, joined since
  • Contributed 706 posts on the community forums.
  • Started 219 threads in the forums
  • Started this discussions
  • Answered 1 question
answered
Senior Member

Thx. Chan, error is gone now and the sorting is fine ;-)

However, there's a little 'problem with the user_geo content when displayed:

Quote

Adresse: Knudshøjvej 6|Strands|Denmark|Syddjurs|Knebel|8420


How can I change the '|' to empty spaces (or something else)?

And i would like it to show like this:

Quote

Adresse: Knudshøjvej 6, Strands, 8420 Knebel
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin


$address = $data['address']; // Knudshøjvej 6|Strands|Denmark|Syddjurs|Knebel|8420
$a = explode("|", $address); // it becomes array and it will break into 6 parts

$street1 = $a[0];
$street2 = $a[1];
$country = $a[3];
$region = $a[4];
$city = $a[5];
$zip = $a[6];

echo "$street1, $street2, $city, $region, $country, $zip";
0 replies
H
helmuth
H
Danish translator of PHP-Fusion helmuth@php-fusion.dk
-----------------------------------------
All people are born alike - except Republicans and Democrats. (Groucho Marx)
Listen to the music... https://soundcloud.com/helmuth-mikkel...mikkelsen/
  • Senior Member, joined since
  • Contributed 706 posts on the community forums.
  • Started 219 threads in the forums
  • Started this discussions
  • Answered 1 question
answered
Senior Member

<?php
 
 $result = dbquery(
 "SELECT user_id as user_id, user_name, user_email, user_phone_mobile, user_phone_home, user_geo
 FROM fusion184Ny_users
 WHERE user_status = 0 ORDER BY user_name ASC"
 );
 
 if (dbrows($result)) {
while ($data = dbarray($result)) {

echo "<div class='list-group-item'>Navn: <strong> ".$data['user_name']."</strong><br/></div> ";
echo "<div class='list-group-item'>Mail: <strong> ".$data['user_email']."</strong><br/></div> ";
echo "<div class='list-group-item'>Mobil: <strong> ".$data['user_phone_mobile']."</strong><br/></div> ";
echo "<div class='list-group-item'>Tlf.: <strong> ".$data['user_phone_home']."</strong><br/></div> ";
echo "<div class='list-group-item'>Adresse: <strong> ".$data['user_geo']."</strong><br/></div> ";
}
 } else {
 echo "No data in table.";
 }
?>


In the code above where do I place your suggested code?

And how do I ensure that the content of user_geo is inserted in your code?
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin


while ($data = dbarray($result)) {

if (!empty($data['user_geo'])) {
$a = explode("|", $data['user_geo']); // it becomes array and it will break into 6 parts
$street1 = $a[0];
$street2 = $a[1];
$country = $a[3];
$region = $a[4];
$city = $a[5];
$zip = $a[6];
$data['user_geo'] = "$street1, $street2, $city, $region, $country, $zip";
}

echo "<div class='list-group-item'>Navn: <strong> ".$data['user_name']."</strong><br/></div> ";
echo "<div class='list-group-item'>Mail: <strong> ".$data['user_email']."</strong><br/></div> ";
echo "<div class='list-group-item'>Mobil: <strong> ".$data['user_phone_mobile']."</strong><br/></div> ";
echo "<div class='list-group-item'>Tlf.: <strong> ".$data['user_phone_home']."</strong><br/></div> ";
echo "<div class='list-group-item'>Adresse: <strong> ".$data['user_geo']."</strong><br/></div> ";
 } else {
0 replies
H
helmuth
H
Danish translator of PHP-Fusion helmuth@php-fusion.dk
-----------------------------------------
All people are born alike - except Republicans and Democrats. (Groucho Marx)
Listen to the music... https://soundcloud.com/helmuth-mikkel...mikkelsen/
  • Senior Member, joined since
  • Contributed 706 posts on the community forums.
  • Started 219 threads in the forums
  • Started this discussions
  • Answered 1 question
answered
Senior Member

Works great - thx for the help.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

H
H
Danish translator of PHP-Fusion helmuth@php-fusion.dk
-----------------------------------------
All people are born alike - except Republicans and Democrats. (Groucho Marx)
Listen to the music... https://soundcloud.com/helmuth-mikkel...mikkelsen/
  • Senior Member, joined since
  • Contributed 706 posts on the community forums.
  • Started 219 threads in the forums
  • Started this discussions
  • Answered 1 question
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet