Question

But I only want to show the last project Id is entered. The client have made a timesheet. If he complete 3 days of the week the projetId will be exemple 567 for the same 3 days. If he made a new one next week it will be 568 for the days he completed. What I want to do is take all information in the database ( location, number of projet , client name) for the last row is entered. ( sorry its hard to explain I do my best) so I'ts will be something like this. Select * from projetstaches when last row (projetId) . I can have multiple projetID with the same ID. So I need to take the last Id entered if I have 5 x the last ID show it. If I have only 1 show me . If I have 50 with the same last ID show me.

HEre my code for the moment I don't know how to take last ID entered.

<?php

include 'connmod.php';
$rs = mysql_query('select  * from projetstaches');
$result = array();
while($row = mysql_fetch_object($rs)){
    array_push($result, $row);
}

echo json_encode($result);

?>
Was it helpful?

Solution

What i understand from your explanation that each time a grater projectid comes if so then you can select data as

select  * from projetstaches
     where projectid= (select max(projectid) from projetstaches)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top