7 PAGES | 1 2 3 4 5 6 7

Table calculator

by David on Thursday 29th January, 2009 at 14:01 COMMENTS (0)

Phew, had a bit of a headache working on calculations based on table data.

For those who want to know how I dealt with the PHP coding for this, here is a basic description.


First sorted all table information into field data variable $cells[][]

Then calculated each cell individually starting from top left and working across and down.

ie in cell B3
!= H1 * 25.5 / 1000

Get that calculation from the cells;
$calc = $cells[2][3];

Split the calculation using;
$calcs = split(" ", $calc);

Now we have each part of the calculation in array variables $calcs

$calcs[1] contains "H1";
$calcs[2] contains "*";
etc.

First calculates H1 * 25.5

H1 is converted into the field location 8 x 1

So we can load that into our variable;
$a = cells[8][1];

So now $a contains the value of this particular item say 21000

So now calculate 21000 * 25.5 and get an answer;
$answer = $a * $b;
$a = $answer;

We loop until all the calculations are used up;

$a now contains 535500
$b gets the next calculation from $calc[] which is 1000

$answer = $a / $b

$answer is 535.5

Store answer in the cells.
$cells[2][3] = $answer;

Thats about it.

All working.

Filed under: CMS Updates

Some great new facilities for our CMS

by David on Monday 26th January, 2009 at 15:01 COMMENTS (0)

Working on two major new add-ons for our CMS;

... Read further about Some great new facilities for our CMS

Filed under:

Intergrated CMS for all

by David on Monday 5th January, 2009 at 11:01 COMMENTS (0)

Happy New Year to all and in 2009 I have started to introduce CMS with all designs that I host.

... Read further about Intergrated CMS for all

Filed under: CMS SEO

More New codes Added to CMS

by David on Tuesday 23rd December, 2008 at 09:12 COMMENTS (0)

New code feature allowing more Search Engine friendly links to be used instead of the click here and more... links to jump to articles.

... Read further about More New codes Added to CMS

Filed under:

Security feature upgrade

by David on Sunday 21st December, 2008 at 11:12 COMMENTS (0)

During all future backups the CMS will check all files against a reference to ensure that the files are up to date and have not been tampered with.

... Read further about Security feature upgrade

Blog . Login

 

Most Recent Posts

5 Most Recent Posts

Most Recent comments

5 most recent comments

Subscribe by Email


 


Categories


Archives

My Flickr stream

www.flickr.com
DrAdept's Favourites photoset DrAdept's Favourites photoset

RSS Feed XHTML CSS 508

[Valid RSS]


 

Dr Adept web design & SEO consultants based in Basildon Essex.