Replace symbol .= php

netkingZ

New Member
#1
hello i have this code:
Mã:
  $thread_qry5= "SELECT * FROM xenProve_prove ORDER BY view_count DESC LIMIT 5";

                                    $row5 = XenForo_Application::get('db')->fetchAll($thread_qry5);

                                    foreach ( $row5 AS $rows5 ) {
                                        $viewid = $rows5['thread_id'];
                                        $viewtitle = $rows5['title'];
                                        $viewuser = $rows5['username'];

                                          $MostView .= 'div style="height:30px; width:640px; border-bottom:1px solid #999;padding:5px;">
                                                  <div style="height:40px; width:500px;float:left">
                                                      <div style="height:20px; width:650px; font-size:16px;color:#6d3f03;">'.$viewtitle.'</div>
                                                      <div style="height:20px; width:650px; font-size:12px;color:#6d3f03;">'.$viewuser.'</div>
                                                  </div>
                                          </div>';
how can replace this symbol .= ? Xenforo system don't read this symbol (.=) I tried :
Mã:
 $MostView = 'div style="height:30px; width:640px; border-bottom:1px solid #999;padding:5px;">
                                                  <div style="height:40px; width:500px;float:left">
                                                      <div style="height:20px; width:650px; font-size:16px;color:#6d3f03;">'.$viewtitle.'</div>
                                                      <div style="height:20px; width:650px; font-size:12px;color:#6d3f03;">'.$viewuser.'</div>
                                                  </div>
                                          </div>' . $MostView;
but don't work. And i tried the For cycle anche the While cycle but don't work. Thanks you
 

Admin

Administrator
Thành viên BQT
#2
You are trying to add a string to another string (by a concatenating assignment operator) that doesn't exist (yet). You have to define the string first:
Mã:
$MostView = '';
and then:
Mã:
foreach ( $row5 AS $rows5 ) {

    $viewid = $rows5['thread_id'];
    $viewtitle = $rows5['title'];
    $viewuser = $rows5['username'];

    $MostView .= 'div style="height:30px; width:640px; border-bottom:1px solid #999;padding:5px;">
                                              <div style="height:40px; width:500px;float:left">
                                                  <div style="height:20px; width:650px; font-size:16px;color:#6d3f03;">'.$viewtitle.'</div>
                                                  <div style="height:20px; width:650px; font-size:12px;color:#6d3f03;">'.$viewuser.'</div>
                                              </div>
                                      </div>';
I don't think this problem is related to XenForo. If you turn on error reporting (just check Google or Stack Overflow) you will get more usefull information about this error.
 
Top