This topic is locked
[SOLVED]

 Two hopefully quick questions....

11/21/2005 6:00:25 AM
PHPRunner General questions
P
poopsie author

Does anyone know how to change the script so that when a new entry is added to my online database it will automatically put it in alphabetical order. Right now when I add something it puts it at the bottom of the list and I have to click on the heading to realphabatise it.
Also, I would like the th default for the number of records to show on a page to be 500, not 20 so there are no pages to go through, I just want it to list all the records when you open it.
One more quick thing, is there a script that I can add that will show a time and date evertime any record is updated or added? Thanks! Matt

Sergey Kornilov admin 11/22/2005

Hi,
you can set the default sorting order for your table and the number of records on the page on Choose fields tab in PHPRunner. Click Changeunder ORDER BYbox to specify the default sorting order and enter 500 into Number of records on first page box.
Then rebiuld your pages.
You can save the record creation and modification time in a table field of DATE or DATETIME type.

To fill it with the curent date and time when the record is added please proceed to Formatting tab in PHPRunner, click Edit format for this field and enter the following default value:

now()


After you build the pages you can add some custom code to update this field with the current date when the record is changed.

Insert the following line into generated ..._edit.php file

$evalues["`Modified`"]="'".now()."'";



just before this snippet:

foreach($evalues as $ekey=>$value)

$strSQL.=$ekey."=".$value.", ";



where Modified is your actual DATETIME field name.

P
poopsie author 11/23/2005

Hi,

you can set the default sorting order for your table and the number of records on the page on Choose fields tab in PHPRunner. Click Changeunder ORDER BYbox to specify the default sorting order and enter 500 into Number of records on first page box.
Then rebiuld your pages.
You can save the record creation and modification time in a table field of DATE or DATETIME type.

To fill it with the curent date and time when the record is added please proceed to Formatting tab in PHPRunner, click Edit format for this field and enter the following default value:
After you build the pages you can add some custom code to update this field with the current date when the record is changed.

Insert the following line into generated ..._edit.php file
just before this snippet:
where Modified is your actual DATETIME field name.


Wow, thanks!

P
poopsie author 11/26/2005

I am guessing that the datetime is for each record on the table? I am looking for one that will be at the top of the page that anytime a new record is added, deleted or changed it changes it records it for that page and posts it at the top. Thanks!

Sergey Kornilov admin 11/28/2005

Hi,
you'll need a database table with one record added to hold the last modified date.
Put this code after every db_exec()function call in _list.php, .._edit.php and ..._add.php files

db_exec("update table1set Modified=now()",$conn);



where table1and Modified are your actual table and field names.
Then put the code to display this last modified date to where you want.

The code can look like this:

<?php

$rslast = db_query("select Modified from table1",$conn);

$datalast=db_fetch_numarray($rslast);

echo $datalast[0];

?>

P
poopsie author 11/28/2005

Thanks again!!!