Page 1 of 1

List from database doesn't display properly

Posted: Mon Apr 19, 2004 5:01 pm
by Locoboy
If i retreive info from my database, it looks like this:
Image
In the last colomn there only should be 'Jaar: 2'
In the 2nd colomn there only should be 'Jaar: 4'
and in the First colomn there only should be 'Jaar: 1'

This is the code that is use, It is a Mod for invision boards. But the as you can see in the image above, the list is not displayed properly. And i can't figure out what to change!?

Code: Select all

1) First sources/Admin/ad_member.php and find:
-------------------------------------------
    $ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code'  , 'domod'  ),
                2 => array( 'act'   , 'mem'    ),
             )      );
  
-------------------------------------------
  Add above, this:
-------------------------------------------   
  //Start Pfields mod
  $numrows=mysql_query("SELECT `fid` FROM `ibf_pfields_data` where 1");
  $numfields = mysql_num_rows($numrows);
  //MOD END

--------------------------------------------

¤) Find:
-------------------------------------------
  $SKIN->td_headerї] = array( "Age" , "10%" );
  
-------------------------------------------
  Replace with, this:
-------------------------------------------   
  $SKIN->td_headerї] = array( "Pfields"       , "10%" );
  
--------------------------------------------

¤) Find:
-------------------------------------------
  
  $DB->query("SELECT m.name, m.id, m.email, m.posts, m.joined, v.*
          FROM ibf_validating v
        LEFT JOIN ibf_members m ON (v.member_id=m.id)
        
-------------------------------------------
  Replace with, this:
-------------------------------------------   
  //Start Pfields mod
     $DB->query("SELECT p.fid, p.ftitle
             FROM ibf_pfields_data p
           WHERE 1");
  $i=1;
  while ( $pfd = $DB->fetch_row() )
  {$fieldnameї$i]=$pfdї'ftitle'];$i++;}
  
  
  for ($i = 1; $i <= $numfields; $i++) &#123;
  $fields .="c.Field_".$i.",";
  &#125;
  
  //MOD END
  $DB->query("SELECT c.member_id,$fields m.name, m.id, m.email, m.posts, m.joined, v.*
          FROM ibf_validating v
        LEFT JOIN ibf_members m ON (v.member_id=m.id)
        LEFT JOIN ibf_pfields_content c ON (m.id=c.member_id)
  
--------------------------------------------
¤) Find the /SECOND/ occurrence of:
-------------------------------------------
    LEFT JOIN ibf_members m ON (v.member_id=m.id)
  
-------------------------------------------
  Add under, this:
-------------------------------------------   
    LEFT JOIN ibf_pfields_content  c ON (m.id=c.member_id)

--------------------------------------------
¤) Find:
-------------------------------------------
  $ADMIN->html .= $SKIN->add_td_row( array( "<b>".$r&#1111;'name']."</b>$coppa" ,
  
-------------------------------------------
  Add above, this:
-------------------------------------------   
  //Start Pfields mod
  for ($i = 1; $i <= $numfields; $i++) &#123;
  $fld="Field_".$i;
  if ($r&#1111;$fld] != "") &#123;$pfieldata .= "<center>$fieldname&#1111;$i]: $r&#1111;$fld]</center>";
  
  if ($i != $numfields)
  &#123;$pfieldata .="<br>";&#125;&#125;
  &#125;
  //MOD END

--------------------------------------------
¤) Find:
-------------------------------------------
  "<center><strong><span style='color:red'>$days d</span>, $rhours h</center>",
  
-------------------------------------------
  Replace with, this:
-------------------------------------------   
  $pfieldata,
What do I have to change to let the list display properly?

Posted: Mon Apr 19, 2004 5:13 pm
by feyd
guessing here.. but this

Code: Select all

for ($i = 1; $i <= $numfields; $i++) { 
  $fld="Field_".$i; 
  if ($r[$fld] != "") {$pfieldata .= "<center>$fieldname[$i]: $r[$fld]</center>"; 
  
  if ($i != $numfields) 
  {$pfieldata .="<br>";}} 
  }
to

Code: Select all

if(!empty($r["Field_".($numfields-1)])
{
  $pfieldata .= "<center>".$fieldname[$numfields-1].": ".$r["Field_".($numfields-1)]."</center>";
}
?

Posted: Tue Apr 20, 2004 10:59 am
by Locoboy
feyd wrote:guessing here.. but this

Code: Select all

for ($i = 1; $i <= $numfields; $i++) { 
  $fld="Field_".$i; 
  if ($r[$fld] != "") {$pfieldata .= "<center>$fieldname[$i]: $r[$fld]</center>"; 
  
  if ($i != $numfields) 
  {$pfieldata .="<br>";}} 
  }
to

Code: Select all

if(!empty($r["Field_".($numfields-1)])
{
  $pfieldata .= "<center>".$filedname[$numfields-1].": ".$r["Field_".($numfields-1)]."</center>";
}
?

:cry: gives a Parse error

Posted: Tue Apr 20, 2004 3:25 pm
by feyd
oops.. misspelled $fieldname... I'll edit my original post.