Here's the problem. I have several tables with various user information. I want to be able to quickly calculate the size that user is using amoung all the tables. I only want to them to have so much space.
I'm looking for something like this..(I realize you need some mysql calls here).
$tableASize = "select sizeofallfields(*) as size from tableA where u_id = '$userID'";
$tableBSize = "select sizeofallfields(*) as size from tableB where u_id = '$userID'";
(Yes, I know there needs some mySQL calls, I'm just looking for the syntax.)
$totalSpaceUsed = $tableAsize + $tableBsize;
The next part is.. Is there a good way to cache this information so the DB doesn't get slammed with calculating usage each time the user adds/updates records? Maybe with another table that has an entry for each user and gets updated say only after adding a new record (not really needed on edit since the space can't grow as much - I don't mind them going over a few kilobytes anyways.)
Thanks in advance for any pointers.
-Mitch