A
|
alang 1/23/2008 |
One way would be:
|
V
|
voicemagic author 1/24/2008 |
One way would be:
|
V
|
voicemagic author 1/24/2008 |
I think I am beginning to understand. My application is an inquiry only, so I have already shut off add/update/delete capabilities & I have located where the query code is to be inserted. Can you give me an idea of what the MySQL query would look like? I have looked through the forum & I'm getting a bit confused as to how to write the query.
|
A
|
alang 1/24/2008 |
Looks like you are missing a database call for a start - try: |
S
|
swanside 1/25/2008 |
Can you not set up a custom view on the Earnings, have the master table Employee set to Employee_ID and detail to Earnings set to Employee_ID and edit the sql to give you this. select
|
V
|
voicemagic author 1/25/2008 |
Looks like you are missing a database call for a start - try: $rs = db_query($str,$conn); $row = db_fetch_numarray($rs); // can also use db_fetch_array then refer to elements by name rather than number $data["skDemoUser"] = $row[0];
|
A
|
alang 1/25/2008 |
There is a bit of an inconsistency here as picked up by swanside. In your original post you imply that there can be multiple earning records for each employee but in your definition of the earnings table, you state the key as being EmployeeID. You should have another primary key field here, say EarningID, and then the EmployeeID is a foreign key linking multiple records back to your master table. |
V
|
voicemagic author 1/29/2008 |
There is a bit of an inconsistency here as picked up by swanside. In your original post you imply that there can be multiple earning records for each employee but in your definition of the earnings table, you state the key as being EmployeeID. You should have another primary key field here, say EarningID, and then the EmployeeID is a foreign key linking multiple records back to your master table. To debug, capture or output the SQL you generate in your code. If still stuck, you can use an SQL tool like SQLyog to independently check the SQL is working as you expect.
|
A
|
alang 1/31/2008 |
I dont think you should be using $_SESSION[$strTableName."_masterkey1"] as the comparison variable. The event you should be using is attached to the master table and this variable would only be set if you were in the child table list view. The event is being processed for every record of the master table and therefore I think your SQL should be: |
V
|
voicemagic author 1/31/2008 |
I dont think you should be using $_SESSION[$strTableName."_masterkey1"] as the comparison variable. The event you should be using is attached to the master table and this variable would only be set if you were in the child table list view. The event is being processed for every record of the master table and therefore I think your SQL should be: $str = "Select sum(buck.balance) from buck where buck.ssn = '".$data["pass_code"]."'"; For debugging this I would be capturing/outputting the $str variable at this point to confirm the SQL is what you expect. I have set up a special debug page that just lists all the SESSION variables in a convenient format - then you just need to put in a debug line: $_SESSION["debug"][] = $str; // this will capure every row processed in an array
|
A
|
alang 2/2/2008 |
The reason that the field is zero is that it is only the list event code that is populating it for you to see. You could probably do a similar trick with print as there are events associated but the export could be a bit more tricky. A better way may be to try a subquery in the SQL - can't help you much with that I'm afraid but if you could get the SQL to give you the right number then it would automatically be right on export and print (and would also show on the master details. |
V
|
voicemagic author 2/16/2008 |
The reason that the field is zero is that it is only the list event code that is populating it for you to see. You could probably do a similar trick with print as there are events associated but the export could be a bit more tricky. A better way may be to try a subquery in the SQL - can't help you much with that I'm afraid but if you could get the SQL to give you the right number then it would automatically be right on export and print (and would also show on the master details. On the detail screen you could generate the same figure by adding a TOTAL for the "balance" field.
|