PCHomepage
Programmer
Can someone help with using %d in a sprintf()? I thought it would take the signed integers which, in this case, are for latitude and longitude, and insert them and it does do so but it rounds them to all zeros after the decimal. The MySQL fields are decimal(8,6) and decimal(9,6) respectively so what would be the proper way to do it other than %s? %s, of course, works but does not seem the best way.
8
PHP:
$sqlInsert = sprintf("INSERT INTO locations (StartDate, EndDate, Location, Address, Lat, Lng)
VALUES ('%u', '%u', '%s', '%s', %d, %d)",
$StartDate,
$EndDate,
$Location,
$Address,
$Lat,
$Lng);