This topic is locked

Flag to indicate detail records exist

7/14/2005 7:47:29 AM
PHPRunner General questions
jpedwardspost author

Hi,

I have phprunner displaying all the rows in master table and a link is provided on each row which takes me to the detail records (where I can add, delete, edit detail records etc).
What I thought maybe useful is when I am viewing all of the master records a small flag or indicator of some kind is provided close to the link to the detail records which indicates that detail records exist for this master record. Maybe a number eg (5) to show that 5 detail records exist for this master record.
The reason for this would be to provide the user with a bit of feedback so that a quick scan down all the master records would reveal any records which have no details but should.
Any ideas <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=1632&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />
Cheers

JP

Sergey Kornilov admin 7/14/2005

The easiest way to count number of details is to run a SQL query for each row on the master page. Here is the sample SQL query:

$sqltemp = "select count(*) from DetailsTable where DetailKeyField = ".$data["MasterKeyField"];

$rstemp = db_query($sqltemp, $conn);

$datatemp = db_fetch_numarray($rstemp);

echo $datatemp[0];