Can't Switch Some Code I've Got And Need Help


Subject: Can't Switch Some Code I've Got And Need Help
I can't get this to switch :oops:

It prints On-Line correctly and if I echo the no_users_on-line separately - that works too ?

ANY help offered? will be appreciated.... :P

Thanks.

Code: [Download] [Hide] [Select]
<?php

/**
* @package (c) 2008 - 2015 Gnu Arcade Script
* @version $Id: user_online.php Version.1.0
* @license http://www.fsf.org/ GNU lesser General Public Licence
*/

if (!defined('IN_ARCADE')) {die('Please use the front door');}

include "includes/db-global.php";
include "includes/config.php";

echo '

'.IMG_TSL.''.$lang['users_online'].''.IMG_TSR.''.SCRST.'
<table class="width100" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="content-a center">

<div style="vertical-align: top; text-align: left;">';

$stmt = $database->query("SELECT status, username FROM " . USERS_TABLE . " WHERE status!=0 ORDER BY username ASC");
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);

foreach($results as $row)
{
$status_ol = intval($row['status']);
$status = htmlEsc($row['username']);

if($status_ol >= time()-15*60){

echo '<div style="display: inline; vertical-align: top; font-weight: bold; font-size: 11px;"> '.$status.', </div>';
}
}

if($status_ol == 0){echo '<div style="font-weight: bold; font-size: 11px; text-align: center;">'.$lang['no_users_online'].' </div>';}

echo '
</div>
</td>
</tr>
</table>
'.SCRSB.''.IMG_TSB.'';

?>

Profile PM  
Subject: Re: Can't Switch Some Code I've Got And Need Help
Hi mort,

Try to remplace this:
Code: [Download] [Hide]
  1. if($status_ol == 0) 

With this:
Code: [Download] [Hide]
  1. if (count($results) == 0) 

Profile PM  
Subject: Re: Can't Switch Some Code I've Got And Need Help
:oops: :oops:

I had the VAR set in "status" to "timestamp" WHY? I don't know :(

I set it to tinyint (4) - no-go -> 127

tinyint NULL - no-go logged-in -> 127

tinyint "signed" - no-go -> 127

VARCHAR (1) - returns 1 or 0 correctly :mryellow:

BUT! I still can't get the switch to work? :(

I'll have a look around and see if it has something to do with PDO, although all the other TINYINT's I use don't cause any problems?

Profile PM  
Subject: Re: Can't Switch Some Code I've Got And Need Help
DOH!

I knew this thing worked on my ASUS Win 7 PC, C - D (XAMPP) where I backed up XAMPP and put it on my new PC (ASUS 115 Gb solid-state) on D: drive (Portable Drive with D (XAMPP) - E - F- G.

Damn MS reported faulty partition on D: so I backed up XAMPP to E:, and ran "Fix It" :shock:

And that's where it all went wrong - it had corrupted XAMPP? and a whole lot of other files on D:went missing! :(

So I got a copy of the arcade-DB from Win 7 and compared it with WinMerge on Win 10 XAMPP "arcade.sql" and Yeah!

NEVER had so many :censored: problems to fix!

Anyway, it's fixed - and thanks for your suggested fix - But it made no difference at the time. :P

AND tomorrow I'll network the two PC's and use the old one for backup - - - :LOL:

Profile PM  
Subject: Re: Can't Switch Some Code I've Got And Need Help
Grats on fixing it -- I'm just surprised it took that much! :LOL:

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Generation Time: 0.112s (PHP: 23% SQL: 77%)
SQL queries: 14 - Debug On - GZIP Enabled