1

I can not figure out how to update the record with a a decimal. For example. For room width, I need to add 4.2 but it rounds to 4. Please help

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == $form_number)) { $updateSQL = sprintf("UPDATE pano_table817 SET room_name=%s, room_width=%s, room_length=%s, delete_image=%s, is_pano=%s, outside_image=%s, floor_level=%s WHERE pano_id=%s", GetSQLValueString($_POST['room_name'], "text"), GetSQLValueString($_POST['room_width'],"numeric"), GetSQLValueString($_POST['room_length'],"numeric"), GetSQLValueString($_POST['delete_image'],"int"), GetSQLValueString($_POST['is_pano'],"int"), GetSQLValueString($_POST['outside_image'],"int"), GetSQLValueString($_POST['floor_level'],"int"), GetSQLValueString($_POST['pano_id'], "int")); mysql_select_db($database_ndctour, $ndctour); $Result1 = mysql_query($updateSQL, $ndctour) or die(mysql_error()); 

HTML Form:

<input type="text" name="room_width" class="input-text-integer" value="<?php echo $row_uploaded_images['room_width']?>">ft</td><td> <input type="text" name="room_length" class="input-text-integer" value="<? php echo $row_uploaded_images['room_length']?>">ft</td><td> 
2
  • 3
    the output of DESCRIBE PANO_TABLE817; would be helpful... especially the data type of room_width Commented Nov 20, 2017 at 2:23
  • 1
    How old is this code? I believe GetSQLValueString is from macromedia DW, nothing from then should be in production today. mysql_ should not be being used. Use PDO or mysqli. They support placeholders which will be similiar to your current usage. Commented Nov 20, 2017 at 3:07

1 Answer 1

2

check your field definition for room_width, it needs to accept decimals with (in your case, with this specific example in mind) at least 1 decimal, and 2 total numbers. This would give you

DECIMAL(2,1) 

give yourself a little room, and use something along the lines of

DECIMAL(4,2) 

if you did have a valid mysql definition, let me know and ill look more in depth

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.