MySQL/PHP Query Issue
Posted: Tue Aug 16, 2005 10:40 am
Hi Everyone!
I'm currently working on a program that ranks something called "headline images". These images are ranked by users. Everytime a scoreboard page is loaded, the scores are recalculated, and each image is assigned a rank (1 being the highest, on down to 100 being the lowest). In addition to checking the rank, I also calculate the duration in which the image was ranked on the scoreboard. I tested the following query in MySQL:
The result displays the correct number of hours that it was ranked on the scoreboard. Next in the php I state:
Anyways, the result continuously displays 0.0000. Can anyone help me out?
Thanks!
I'm currently working on a program that ranks something called "headline images". These images are ranked by users. Everytime a scoreboard page is loaded, the scores are recalculated, and each image is assigned a rank (1 being the highest, on down to 100 being the lowest). In addition to checking the rank, I also calculate the duration in which the image was ranked on the scoreboard. I tested the following query in MySQL:
Code: Select all
SELECT ((UNIX_TIMESTAMP()-ranked_start)/60/60) AS duration_hours FROM headline_images;Code: Select all
$sql = "SELECT ((UNIX_TIMESTAMP()-t1.ranked_start)/60/60) AS duration_hours FROM headline_images AS t1";
$result = mysql_query( $sql )....... yada yadaThanks!