15

I am playing with my own implementation of Google maps and I want to do it properly through prepared statements and mysqli object (not mysql as stated in the linked example) Also, I added "own registration" so I am afraid of SQL Injection. But, how do I bind Float value to the prepared statement?

My table has (among others) FLOAT type columns:

CREATE TABLE `markers` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 60 ) NOT NULL ,
`description` TEXT NOT NULL ,
`lat` FLOAT( 10, 6 ) NOT NULL ,
`lng` FLOAT( 10, 6 ) NOT NULL ,  
) ENGINE = MYISAM ;

But reading the manual I can see only these types:

Character   Description
i   corresponding variable has type integer
d   corresponding variable has type double
s   corresponding variable has type string
b   corresponding variable is a blob and will be sent in packets

Should I assume that when column is a FLOAT i should use b for a blob? (because its not string and not a double value). And the same for TEXT type column?

Pavel Janicek
  • 14,128
  • 14
  • 53
  • 77

1 Answers1

37

Just use "d" for non integer numbers

gyss
  • 1,753
  • 4
  • 23
  • 31