1
arlindo
PHP Independent Block
  • 2009/12/7 16:36

  • arlindo

  • Just popping in

  • Posts: 23

  • Since: 2007/10/9


Hi there, I wanted to use one PHP Costum Block with some querys to the database, but when i turn the block to "Visible", it bloks my website showning only one blank page. I have to go directly to the database and de-activate directly the block to have my website back on-line again. Do you know the reason this is happening to me? My XOOPS versions is the 2.4; My PHP version is the 5 Sample code i am Using: getVar('uid'); $current_balance = 0; $result = $db->query("select balance from history where uid = '$uid'"); if($db->getRowsNum($result) > 0) { $row = $db->fetchArray($result); $current_balance = $row["balance"]; } echo "Your current balance is $current_balance"; ?> Any Ideas??

2
arlindo
Re: PHP Independent Block
  • 2009/12/9 15:23

  • arlindo

  • Just popping in

  • Posts: 23

  • Since: 2007/10/9


Anyone has solution for this?

A sample of one similer block working?

3
ghia
Re: PHP Independent Block
  • 2009/12/9 15:58

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


$xoopsuser is undefined if not logged on.
Test this before using it:
if (is_object($xoopsUser)) {

I don't think the include is needed.
An example for a block is here and here.

Login

Who's Online

264 user(s) are online (200 user(s) are browsing Support Forums)


Members: 0


Guests: 264


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