Mathematical calculations and arrays... And data decoding from the SQL database.

Hi everyone.
How can I divide a value of an array and print the answer? I’ve tried this:

[php]while($row = mysql_fetch_row($query)) {
$test = $row[1];
$res = ($test / 60);
echo “

echo ‘’ . $row[0] . ‘’;
echo ‘’ $res ‘’;
echo ‘’ . $row[2] . ‘’;
echo ‘’ . $row[3] . ‘’;
echo ‘’ . $row[4] . ‘’;
echo “\n”;
It didn’t worked though…
I want to do that, so I can get hours from minutes.

Also, there’s random numbers for dates in the database… Is there any way to decode them and print them? For example: 1296907096.
I realize, that this isn’t random numbers, but it doesn’t make any sense to me, which means, they are probably encrypted.


Hi there,

Maybe the explode function will be of use to you?

Those numbers are UNIX timestamps -> the example given equates to 05.02.2011 12:58:16 (created with time(), converted to normal using date())

Not sure how to work with time:
$row[5] = date(“d-m H:i”, strtotime(’$row[5]’)); gives me 01-01 01:00 everywhere… :confused:

And I’m really not sure what to do with that explode function. Tried something, but didn’t even near what I need…

Sponsor our Newsletter | Privacy Policy | Terms of Service