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/>";}


?>

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";

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?

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.

Member Avatar for diafol

How do you propose to check the table without a date reference?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.