Jump to content

Mysqli bind_param and type castin Error


sammysam

Recommended Posts

Hello Everybody,

I'm experiencing a weird issue, most probably cause of lack of expertise or maybe I'm just missing something.

I'm using the following code

$sql = "INSERT INTO tags(tag,woeid,photoId, offset ) VALUES (?, ?, ?, ?)";
$id=$photo['id'];
$stmt->bind_param('sssi',$tag_name,$woeid,$id,$limit);

All is ok but the parameter $id. In the Mysql Table if I define $id as integer whatever value it has will be converted in 2147483647 I really don't know why!

$id is actually a string so i though i could type cast before binding with

$id=(int) $photo['id'];
$stmt->bind_param('ssii',$tag_name,$woeid,$id,$limit);

  but I had no luck, still that weird value. The only thing that seems to work is updating the table letting that columns be a varchar..but I need an Integer!

Is it a problem of mysqli or mysql? I think I spent 5 hours trying to figure this problem out.

Any help?

 

Thanks, bye bye

Link to comment
https://forums.phpfreaks.com/topic/222684-mysqli-bind_param-and-type-castin-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.