phpnoobx Posted January 3, 2014 Share Posted January 3, 2014 (edited) Hey guys, i have a simple script here which didnt work: <html><body><?php $con = mysqli_connect("","root"); mysqli_select_db($con, "firma"); $sql = "update personen set gehalt = gehalt * 1,04"; mysqli_query($con, $sql); $num = mysqli_affected_rows($con); echo "<p>Es wurden $num Datensätze geändert</p>"; mysqli_close($con); ?><p>Alle Datensätze <a href="db_tabelle.php">anzeigen</a></p></body></html> i want all numbers from money * 1,04 but it didnt work. so maybe somebody can help me or say whats wrong with it. the script is local that means i use xampp Edited January 3, 2014 by phpnoobx Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted January 3, 2014 Solution Share Posted January 3, 2014 I think MySQL only recognises floats with a period (1.04) not a comma $sql = "update personen set gehalt = gehalt * 1.04"; You can reformat the decimal place back to a comma with number format Quote Link to comment Share on other sites More sharing options...
phpnoobx Posted January 3, 2014 Author Share Posted January 3, 2014 thank you it works now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.