Okay I think I really need to go about this another way, you both have suggested using my database rather than this function and I believe that would be a better route. Because what I am doing now is using PHP to update data from the tables, rather than just updating the tables to then use in my PHP.
So here's my next question, how can I write and IF,ELSE statement for MySQL to UPDATE my tables. (http://dev.mysql.com/doc/refman/5.0/en/if-statement.html).
I figured something like this would be what I'm after, just my syntax must not be correct. Again what I am after is too update the tables with the if,else statements.
IF owners.ab = ' '
INSERT ditches.min INTO owners.ast FROM owners, ditches WHERE owners.id = '504' AND owners.id = ditches.id
ELSE
INSERT (owners.ab * ditches.acre) INTO owners.ast FROM owners, ditches WHERE owners.id = '504' AND owners.id = ditches.di
END IF;
So what that should read is:
If the owners ab column is empty,
insert the ditches min amount into owners ast column where the owners id is 504 and join ditches id with owners id
if it is not empy
then insert the owners ab column multiply by the ditches acre column into the owners ast column from the owners table where the owners id is 504 and join the ditches id with owners id
Does that make sense at all? And how would I do that? Please and THANK YOU so very much!