1
dolphino
Custom block???
  • 2003/11/14 9:41

  • dolphino

  • Just popping in

  • Posts: 7

  • Since: 2003/11/12


Hello
I´m a newcomer at using XOOPS but I have a problem.The situation is: In a database I have a table xoops_data_kli which consist of information about clients.I always need to show all information that belongs to the client. The table consists of an item user_id which is the same as the user´s XOOPS login name...
Could you anyone help me please?

2
ackbarr
Re: Custom block???

...and you want to show this information for each client in a block? Set your custom block's content type to php and try something like this:

global $xoopsUser$xoopsDB;


//Ensure the current viewer is logged in
if ($xoopsUser) {
  
//Setup SQL Query
  
$sql "SELECT * FROM " $xoopsDB->prefix('data_kli') . " WHERE user_id = '" $xoopsUser->getVar('uname') . "'";

  
//Send SQL Query to server
  
$ret $xoopsDB->query($sql);
  
  if (
$ret) {
    while (
$myarr $xoopsDB->fetchArray($ret)) {
      
//Output each record returned from the db
      //Variables are avialable like this:   
      //$myarr['user_id']
    
}
  } else {
    
//No records returned
    
return false;
  }
} else {
  
//Current viewer is not logged in
  
return false;
}



3
dolphino
Re: Custom block???
  • 2003/11/15 11:38

  • dolphino

  • Just popping in

  • Posts: 7

  • Since: 2003/11/12



Yes, thnx

Login

Who's Online

248 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 248


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits