PHP code stored in DB - need to execute
Posted: Fri Jan 14, 2005 6:12 pm
Hello all,
I've been a big fan of PHP for some time - developed some sites and I must say it is my favorite language. I'm not too advanced of a developer, and this is my first post because it is the first time I couldn't find the help I needed online. Mostly because I just don't know how to say what I'm trying to do.... hoping someone here can help me out.
ANYWAYS....
Basic shopping cart functionality - I have a coupon code that the user enters in a form - it checks the database and returns the actual code I want to process from the database.
Example, if the coupon code was coupon1, it might pull something out of the database like this:
=(.10*$Cart->total)
What I want is to actually execute this code (and return the actual float)instead of reading it as a string. I'm sure there is an easy way to do this - and I'm even more sure that there is an easier way to process "coupons". Let me know your thoughts, I appreciate your help.
K
I've been a big fan of PHP for some time - developed some sites and I must say it is my favorite language. I'm not too advanced of a developer, and this is my first post because it is the first time I couldn't find the help I needed online. Mostly because I just don't know how to say what I'm trying to do.... hoping someone here can help me out.
ANYWAYS....
Basic shopping cart functionality - I have a coupon code that the user enters in a form - it checks the database and returns the actual code I want to process from the database.
Example, if the coupon code was coupon1, it might pull something out of the database like this:
=(.10*$Cart->total)
What I want is to actually execute this code (and return the actual float)instead of reading it as a string. I'm sure there is an easy way to do this - and I'm even more sure that there is an easier way to process "coupons". Let me know your thoughts, I appreciate your help.
K