I am a PHP/MySQL newbie, but I have managed to upload our MS Access database tables to a Linux webserver with relative ease, thanks to the latest version of PHPRunner 4.1.
We have two main tables; the rest are lookup tables.
The two main tables are tblClient and tblClientCase (one Client to many ClientCases). In practice though one Client has one ClientCase in our database. The tables are not linked.
A unique row or recordset in tblClient is identified by ClientID.
A unique row or recordset in tblClientCase is identified by CaseID and foreign key ClientID from tblClient (i.e. 'tblClientCase'.'CaseID' and 'tblClient'.'ClientID').
Client Data is added, edited, or viewed by user on the "Client Data" Tab after log in.
The remaining tabbed pages (provided by PHPRunner) can then be viewed or edited. These remaining tabbed pages each provide a view on a grouped number of fields taken from tblClientCase. The first of these remaining tabbed pages has "Add New" command button in addition to "Edit" hyperlink, the rest have only an "Edit" hyperlink.
I would like to use the ClientID of the currently viewed Client on the Client Data tab to view or edit all the other tblClientCase tabs.
At present a user has to memorise the ClientID value from the first Client Data screen. Then on all other screens relating to ClientCase (tblClientCase views) the user searches for ClientID equals ### before proceeding, which is very time consuming.
I figure from extensive reading of postings on this site that the solution is to store the currently viewed ClientID [Client Data tab] in a global $_SESSION variable and then use this value to access (pardon the pun) all the views on tblClientCase as a constraining variable in a SELECT FROM tblClientCase WHERE 'tblClientCase'. 'ClientID' = 'tblClient'.'ClientID' statement.
The posting I found most similar to my requirement is http://www.asprunner.com/forums/index.php?...&hl=Stoppay, and he seems to have figured it out using $_GET['editid1']
I guess what I want is:
$_SESSION['ClientID'] = Currently viewed ClientID (on Client Data tab/page)
If $_SESSION['ClientID'] is found in 'tblClientCase' then
$strSQL = SELECT FROM tblClientCase WHERE 'tblClientCase'. 'ClientID' = 'tblClient'.'ClientID'
Else
AddNew (insert into tblClientCase (ClientID) values 'ClientID' etc)
OR
$_SESSION['ClientID'] = Currently viewed ClientID (on Client Data tab/page)
If $_SESSION['ClientID'] is found in 'tblClientCase' then
$strSQL = SELECT * FROM tblClientCase WHERE 'tblClientCase'. 'ClientID' = $_SESSION['ClientID']
Else
AddNew (insert into tblClientCase (ClientID) values $_SESSION['ClientID'] etc)
I do not know whether it is a client side javascript solution that is required or whether it could be done server side. I am not sure which Event function (eg BeforeEdit, Onload) or even which php file to edit. In short any help would be immensely valuable and appreciated.
Thanks
darkwa