• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Znote AAC-Having an issue with a code

Jfrye

Mapper, trying to learn scripting
Joined
Jan 8, 2009
Messages
365
Solutions
5
Reaction score
86
Location
Mexico Missouri
I cannot get this to work right. If anyone can tell me what I am doing wrong, I would greatly appreciate it.

Code:
<?php if ($znote_acc_data['premdays'] > 1) 
                        echo '<td><font color="green">Premium Account</font></td>';
                    elseif ($znote_acc_data['premdays'] < 1)
                        echo '<td><font color="red">Free Account</font></td>';  ?>

It will not show up right on the website if the character has premium account or free account. I have tried using google to search for solutions, and tried changing to different values, and I still cant get this to work right.
 
Solution
Code:
<?php echo mysql_select_single("SELECT premdays FROM accounts a LEFT JOIN players p ON a.id = p.account_id WHERE p.id=$user_id")['premdays'] > 0 ? "Premium account" : "Free account"?>

Thanks @Bogart for getting this fixed for me.
I cannot get this to work right. If anyone can tell me what I am doing wrong, I would greatly appreciate it.

Code:
<?php if ($znote_acc_data['premdays'] > 1)
                        echo '<td><font color="green">Premium Account</font></td>';
                    elseif ($znote_acc_data['premdays'] < 1)
                        echo '<td><font color="red">Free Account</font></td>';  ?>

It will not show up right on the website if the character has premium account or free account. I have tried using google to search for solutions, and tried changing to different values, and I still cant get this to work right.
PHP:
<?php
    if (intval($znote_acc_data['premdays']) >= 1){
        echo '<td><font color="green">Premium Account</font></td>';
    }
    elseif (intval($znote_acc_data['premdays']) < 1){
        echo '<td><font color="red">Free Account</font></td>';
    }
?>

or

PHP:
<?php
    $daysLeft = intval($znote_acc_data['premdays']);
    if ($daysLeft >= 1){
        echo '<td><font color="green">Premium Account</font></td>';
    }
    else{
        echo '<td><font color="red">Free Account</font></td>';
    }
?>
 
I will try this tonight. I'm trying to learn what all this stuff does. Would anyone have time to tell me what intval is or does?
 
@Codex NG is there something else I need to add to the script? I have tried both codes you posted, and neither of them change the account status on the website. The account used for testing is always tested with either 10 days or 0 days of premmy.
 
@Codex NG is there something else I need to add to the script? I have tried both codes you posted, and neither of them change the account status on the website. The account used for testing is always tested with either 10 days or 0 days of premmy.
Use print_r on intval($znote_acc_data['premdays'])
Code:
print_r( intval($znote_acc_data['premdays']) );
And tell us what prints to the page.
 
Code:
<?php echo mysql_select_single("SELECT premdays FROM accounts a LEFT JOIN players p ON a.id = p.account_id WHERE p.id=$user_id")['premdays'] > 0 ? "Premium account" : "Free account"?>

Thanks @Bogart for getting this fixed for me.
 
Solution
Back
Top