3

Based on this table from PHP .net :

Type specification chars
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

I write code:

$stmt = $this->conn->prepare("INSERT INTO days(day,startLocation) VALUES(?,?)");
        $stmt->bind_param("ss", $day, $startLocation);

but problem is becouse my startLocation field in database use type POINT, so

How I can make bind_param with POINT dataType in mysql?

13
  • Where can I find the said table on php.net? Commented Dec 5, 2014 at 20:14
  • php.net/manual/en/mysqli-stmt.bind-param.php Commented Dec 5, 2014 at 20:15
  • INSERT INTO days(day,startLocation) VALUES(?, POINT(?, ?)? Commented Dec 5, 2014 at 20:19
  • no, I get error Call to a member function bind_param() on a non-object in - on that line where is INSERT etc... Commented Dec 5, 2014 at 20:23
  • The bind_param() on a non-object error means the prepare() call already failed, so something is amiss with the SQL statement itself rather than variable types. Check echo $this->conn->error; to find out why after attempting to call prepare(). Commented Dec 5, 2014 at 20:28

1 Answer 1

1

You should use MYSQL function POINT in order to convert from Latitude/Longitude

$stmt = $this->conn->prepare("INSERT INTO days(day,POINT(lat,lon)) VALUES(?,?,?)");
        $stmt->bind_param("sdd", $day, $lat, $lon);
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.