PHP - Moved: Float At Div
This topic has been moved to CSS Help.
http://www.phpfreaks.com/forums/index.php?topic=312178.0 Similar TutorialsCan someone clear up my confusion about FLOAT. I have data in a TINYINT field that displays whole numbers WITHOUT any decimal places. This does not format very nicely when there are ALSO decimalled values to be echoed: 1 1.5 2 2.5, etc. It can be a little confusing. The only way I've thought of to resolve the issue (if you know another, please share) is to add a decimal place to get: 1.0 1.5 2.0 2.5 etc. But I am unclear on WHERE to put the commands to get this result. Does it go into the actual DB? Or into my PHP script? Please help with a detailed example. Thanks The following returns strings instead of floats. Am I able to retrieve floats directly from PDO and/or PostgreSQL or must I manually type cast them afterwards using PHP? Thanks $sql='WITH RECURSIVE t AS (bla bla bla) SELECT id, CAST(SUM(slope*value+intercept) AS FLOAT) "value", SUM(slope*prev_value+intercept)::FLOAT "prevValue" FROM t WHERE type=\'physical\' GROUP BY id'; $stmt = $this->pdo->prepare($sql); $stmt->execute($ids); $arr = $stmt->fetchAll(\PDO::FETCH_UNIQUE); //returns [123=>['value'=>'123.456', 'prevValue'=>'122.234'], ...]
first person to solve this gets an automatic, irrevocable entry into my VIP Holiday Card Master List. ive been tussling with it for hours over two days and cannot figure out what the problem is.
site: http://104.152.168.18/~redtagsp/
you'll see five image buttons in the center of the homepage. red bg is for diagnostic only. the third of the smaller images in the top row is sitting slightly lower than the others. the containing element (transparent black) is floated as are all 5 images within it. and the text-div above the images. seems really simple but ive had these frigging elements bobbing all around and this is the best i can get them. my guess is there is some CSS outside of my own (this is a Wordpress site) that is screwing things up for me but i cant find it.
here is the HTML for the containing element:
<div id='home_buttons'> <div id='free_shipping'><strong>FREE</strong> Shipping on all orders over $40</div> <a href=''><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/button_blank_pucks.png' class='home_button_small'></a> <a href=''><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/button_custom_pucks.png' class='home_button_small'></a> <a href=''><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/button_custom_pucks.png' class='home_button_small'></a> <div style='float:left; clear:both; width:100%; height:5px;'></div> <a href='' class='link_button_large'><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/tape.png' class='home_button_large'></a> <a href='' class='link_button_large'><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/balls.png' class='home_button_large'></a> </div>here is the CSS directly associated with the above: #home_buttons { float:left; width:95.4%; padding:1%; margin:100px 1% 20px 1%; background:rgba(0, 1, 17, 0.75); border-radius:10px; } #free_shipping { float:left; width:100%; text-align:center; border-radius:5px; background:#555; color:#fff; margin-bottom:10px; } #home_buttons a { float:left !important; max-width:32.8%; margin:0 0.5% 0 0; padding:0px !important; background:red; clear:none !important; } .link_button_large { float:left !important; max-width:49% !important; margin:0px 2% 0px 0px; clear:none; } .link_button_large:last-of-type { margin:0px; } .home_button_small { float:left; max-width:100%; } .home_button_small:last-of-type { margin-right:0%; } im trying to update a GPS table for example: UPDATE markers SET lat = '38.40907441955112' AND lng = '14.943452775478363' WHERE ApID = '35911' i tried with float 20,18 it isnt updatng correctly Hello, The data that actually gets stored in my database differs from what I'm trying to put there. Here's a short code snippet: $lat = 42.272939; $lng = -83.622941; // insert cordinates into dB $query = "INSERT INTO markers (lat, lng, user_id) VALUES ('$lat','$lng','$user_id')"; $results = mysql_query($query) or die(mysql_error()); When I look in the database, the data is stored as: 42.272938 and -83.622940. Any ideas as to why this happens? These values are being stored as float(10,6). Not sure if this is useful, but here's some other info: datbase: MySQL engine: InnoDB Format: Compact Collation: utf8_general_ci Thanks I know I may sound like a nab, but here I go: Code: [Select] $ric=10; $price=$price+($price/$ric); Basically I want to add a 10% to the price value this is inside a "for", and price values is taken from a csv file. Said value is for example: $price=4,36 after the script takes place, the value goes to: $price=4796 While i aimed to obtain 4,80 (a 2 precision float). Can anyone help me? It's the first time I mess with float numbers. EDIT: Or at least direct me to a more efficient way to apply % on doubles, while preserving the original precision Hi, in Mysql have a row with FLOAT 10,2 In form put the number 20.20 and after reload in form show: 20.200000762939 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342919.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=356314.0 This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=319595.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=345722.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=333865.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=319767.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=313579.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=342987.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=331097.0 The PHP Coding Help section is not the place to recruit someone to work on your project. It's for answering specific questions about specific code. This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=347446.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=343318.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=356760.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=334099.0 |