phpnoobx Posted January 3, 2014 Share Posted January 3, 2014 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 Link to comment https://forums.phpfreaks.com/topic/285060-php-code-didnt-work/ Share on other sites More sharing options...
Ch0cu3r Posted January 3, 2014 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 Link to comment https://forums.phpfreaks.com/topic/285060-php-code-didnt-work/#findComment-1463710 Share on other sites More sharing options...
phpnoobx Posted January 3, 2014 Author Share Posted January 3, 2014 thank you it works now Link to comment https://forums.phpfreaks.com/topic/285060-php-code-didnt-work/#findComment-1463726 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.