SQL - EVAL() help
Posted: Mon Oct 12, 2009 8:04 am
I am attemtpting to execute code, these forumlas, that are stored in a SQL server, but I cannot figure out how to run the code atm.
This is the SQL data atm, and what I need to do is execute this code as php. The problem I am running into, is after I do the calls:
I cannot figure out how to execute the array of said formulas.
I have tried to use eval(); like this:
but it does not work.
Essentially, I want to make it so if Carrier 1 was selected, a statement executes as follows:
Thanks for any help
apologies if I am not descriptive enough.
Code: Select all
Carrier 1 Carrier 2 Carrier 3 Carrier 4
(($fuelPrice-1.15)/6) (($fuelPrice-1.13)/6) (($fuelPrice-1.10)/6) (($fuelPrice-1.15)/4.5)Code: Select all
<?php
$fuelStringTable = mssql_query("SELECT CARRIER1, CARRIER2, CARRIER3, CARRIER4 FROM FUEL");
$fuelString = mssql_fetch_array($fuelStringTable, MSSQL_ASSOC);
?>I have tried to use eval(); like this:
Code: Select all
eval("\$x = \"$x\";");Essentially, I want to make it so if Carrier 1 was selected, a statement executes as follows:
Code: Select all
$fuelCost = (($fuelPrice-1.15)/6);apologies if I am not descriptive enough.