0

hello... i have a question about my final year project..
in my database i want to find 5 maximum values from total of defects from car's body...
and the data that i'm found must valid for one year, and after one year (next year) maybe the 5 max values may changed. My problem now, how the data can fixed for one year only and the next year can be a another values.

my coding here

<?php
include 'connection.php';
$j = "SELECT defect_code,total FROM grandTotal ORDER BY total DESC LIMIT 5";
$h = mysql_query($j);
while ( $rws = mysql_fetch_array($h)){
echo $rws['defect_code']." = ".$rws['total'];
echo "<br/>";}


?>
3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by diafol
0

you'll need to add some time/date columns to the database so you can do something like:

$j = "SELECT defect_code,total FROM grandTotal WHERE year = '2011' ORDER BY total DESC LIMIT 5";
0

if i dont want to add field date/time, its cant be run or not? i want to generate it automatically..based on PC time.. it is flexible?

0

if i'm understanding the question correctly then no. regardless if its pc time or server time each record will have to have a date associated with it, it's not like you can right click the entries and look at the properties and it will show a date. it would have to be a column in the database.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.