dukeispie dukeispie - 1 year ago 63
HTML Question

Getting number from database, then subtracting it doesn't work

I have tried creating a script to prevent spamming. Every 30 seconds will allow you to post again. I am using

to use it (php unix time) and then uploading it to the user's profile. So
=time(); (basically)

$ayy = $user['lastpost'];

That returns the user last posted. For this example, the last time the user has posted was 14423658.
When I apply simple math to it, such as

die($ayy - 3);

it will output nothing.
If I convert the value to a integer, doing

$ayy = intval($user['lastpost']);

value will just become null (blank). How I know this is when I perform


It outputs nothing.
If I do

$ayy = intval($user['lastpost']);
die($ayy - 1);


$ayy = $user['lastpost'];
die(intval($ayy - 1));

They all output nothing.
You'd expect something like this to be very simple, but I have spent days pondering this, and it is really frustrating.

If you do contribute, thanks.

When var_dump is applied to $ayy, this is what it outputs:

is applied to
, this is also what it outputs:
. It was working the whole time (with
) but it didn't output anything. Problem Solved, but why is it outputting blank?

Answer Source

According to manual http://php.net/manual/en/function.exit.php (exit is equivalent for die):

if status is integer it's not printed.

If you want to print it with die(I don't know why) do like this die((string)$ayy).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download