MySQL/PHP Query Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
biznickman
Forum Newbie
Posts: 13
Joined: Tue Aug 16, 2005 10:32 am

MySQL/PHP Query Issue

Post by biznickman »

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:

Code: Select all

SELECT ((UNIX_TIMESTAMP()-ranked_start)/60/60) AS duration_hours FROM headline_images;
The result displays the correct number of hours that it was ranked on the scoreboard. Next in the php I state:

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 yada
Anyways, the result continuously displays 0.0000. Can anyone help me out?

Thanks!
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Do not bump the thread 18 minutes after creating it.
Post Reply