I’m a PHP and SQL newbie. By inspecting the following template code in the EE site I inherited, I was able to find the name of a table/array, (order_info) used in our shopping cart template:
// put Credit Card info into database
$cmd = “INSERT INTO order_info VALUES(’‘, ‘$fullName’, ’” . base64_encode($cardNumber) . “‘, ‘$expireDate’, ‘$theTime’, ‘$cvv’)”;
$cmdResult = mysql_query($cmd) or die(mysql_error());
I figured out how to use CP/ADMIN/Utilities/SQL Manager/Database Query Form to run SELECT * FROM order_info to view the contents of this table, and even how to APPEND a column to hold the cvv number from the back of the credit card. Once I had the table/array, it was fairly easy. The problem was finding the table/array.
My question is, isn’t there some way to get a list of all the tables/arrays in the database? Going through all the code to find them takes forever. I tried CP/ADMIN/Utilities/SQL Manager/Database Manager but it doesn’t list order_info, just a whole lot of things like exp_members. I thought, maybe order_info is recreated fresh every time there’s an order, but that’s not true - it accumulates orders from different customers until they are downloaded and cleared. Before SQL, there were commands like “list databases” or “list tables.” How do you do that in SQL?
In a similar vein, is there some way to see variables or string values? This is related to a more pressing problem. The same shopping cart template has an algorithm to set a discount price up to a month before the date of a seminar. The code is:
thetime= time()
if($_POST[‘Conference’] == ‘Conference April 22, 2011’
&& $thetime < mktime(24, 0, 0, 3, 22, 2011)) {
$theprice = '150.00';
}
elseif($_POST[‘Conference’] == ‘Conference October 4, 2011’
&& $thetime < mktime(24, 0, 0, 9, 4, 2011)) {
$theprice = '150.00';
}
else {
$theprice = ‘175.00’;
This has worked for years without problems - all I’ve had to do is change the dates each year. But suddenly, the price for the upcoming April 22 conference hasn’t changed from $150 to $175. I can’t figure out what’s wrong, as no matter what values I assign to $theprice, it always stays at $150 in the shopping cart. Isn’t there some way to view the value of $theprice and mktime as I run the code? Some list of variables and values and strings and their current values, or a way to view them?
Thanks