PHP regex (regular expression) question?

Aaron

New member
Ok, so I currently have a system in place where in the database you have an item. And a reference name in the database to another field.

Like so:
Item Name, Cal by
Shoes VAT

So my php will run through check the Cal by is VAT then go to a single database which has the VAT % and use that value in a calculation.

However I also wish to use things such as
VAT * X / Y
within my database so the return of the query would be the above. Then use a regular expression to split up the three components such as:

VAT,
X,
Y

And using the delimiters from the database carry out their associated mathematical function.

VAT * X / Y

So far I know this works

<?php

$getCalBy = mysql_query("SELECT * FROM myTable WHERE ...");
$result = mysql_result($getCalBy, 0, 'Cal By');

?>

So far this is fine for any single entry however I need to identify the individual values, any helping hands out there?
 
you might try by chunking the lines by each field's width, then parse the strings to numbers using intval()

if you could post (or im me) what is contained in $result, i could give you a more concise answer
 
Back
Top