Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.