This topic is locked

automatically display the newest record in a table after logon

6/10/2008 10:47:00 PM
PHPRunner General questions
B
bochaka author

Hi

At the moment after successfull logon my users goto the list page, i used the redirect to page event in the after successfull login. Is it possible instead to redirect them to the latest record added VIEW page.

J
Jane 6/11/2008

Hi,
select ID of latest added record in your AfterSuccessfulLogin event and redirect to the view page of this record:

global $conn;

$rs = db_query("select RecordID from TableName order by FieldName desc",$conn);

$data = db_fetch_array($rs);

$id = $data["RecordID"];
header("Location: TableName_view.php?editid1=".$id);

exit();

B
bochaka author 6/11/2008

Hi,

select ID of latest added record in your AfterSuccessfulLogin event and redirect to the view page of this record:



Works a treat, thank you again Jane.