yatahaze Posted June 15, 2006 Share Posted June 15, 2006 What I want to do is simple: grab the text from a field in the database. My canadian shipping module returns costs in CDN funds and I want to get the conversion rate (called "value") from the database which I have stored in my Canadian currency, that way the price would show in USD. I already know exactly where to put it: 'cost' => (SHIPPING_HANDLING + $cost * 0.91) * $shipping_num_boxes); I want to replace the 0.91 with the info from the db. Can anyone show me how? I don't need the exact code to make it work, even just the code I could use to grab any field of text would help. Thanks. Link to comment Share on other sites More sharing options...
yatahaze Posted June 15, 2006 Author Share Posted June 15, 2006 This is my idea (that doesnt work): $usdconvert = tep_db_query("select value from " . TABLE_CURRENCIES . " where currencies_id = '3'"); Then I replace the 0.91 with $usdconvert, but that doesnt work. Link to comment Share on other sites More sharing options...
yatahaze Posted June 15, 2006 Author Share Posted June 15, 2006 I have code that returns the exact information I want, however when I replace it with the 0.91 the cost result is always 0. When I enter in an actual number, it always works. Works: 'cost' => (SHIPPING_HANDLING + $cost * 0.91) * $shipping_num_boxes); Doesnt work: 'cost' => (SHIPPING_HANDLING + $cost * $exchange_amount_row["value"]) * $shipping_num_boxes); The code I'm using to get the exchange amount (works when I echo the exchange amount anywhere else but where I showed above): $exchange_amount = mysql_query("SELECT value FROM " . TABLE_CURRENCIES . " WHERE currencies_id=3"); // change 6 to whatever your currency is - check mysql table currencies $exchange_amount_row = mysql_fetch_array($exchange_amount); $dollar_amount = $exchange_amount_row["value"]; $dollar_amount = number_format($dollar_amount, 2); $exchange_amount_row["value"] = number_format($exchange_amount_row["value"], 2); Any ideas? :blink: Link to comment Share on other sites More sharing options...
yatahaze Posted June 15, 2006 Author Share Posted June 15, 2006 Ahhh I got it. I had to put that last section of code inside the function where I was trying to use the $exchange_amount_row["value"], instead of at the top of the file. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.