Hi. I am using the following code to store some floats. Anyone got any ideas why the db would store them as ints? The table rows are floats, I did check that...
function currtable_insert_currency($cur){
if (!($gbprate = currtable_get_conversion('GBP',$cur))) $gbprate = 0;
if (!($eurrate = currtable_get_conversion('EUR',$cur))) $eurrate = 0;
if (!($usdrate = currtable_get_conversion('USD',$cur))) $usdrate = 0;
db_query("INSERT INTO {currtable} (ctid,ctgbprate,cteurrate,ctusdrate) VALUES ('%s',%f,%f,%f)",$cur,$gbprate,$eurrate,$usdrate);
drupal_set_message('New currency inserted: '.$cur.', GBP rate = '.$gbprate.', EUR rate = '.$eurrate.', USD rate = '.$usdrate);
}
That drupal_set_message outputs floats, so go figure.
Please help.
Comments
Comment #1
Anonymous (not verified) commentedNever mind. I'm an idiot, had the same table updating using %d in another place...
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.