-2

MySqli problem: i used this query to update a field in table.

mysqli_query($con, " UPDATE users SET profile_pic = '$img_name' WHERE id = '$id' ");

where

$img_name = time().$id;

and

$id = 3;

when I echo $img_name, it give correct result. but value stored in database it gives 2147483647 ie maximum integer value for my 32bit computer.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
rahulbehl
  • 2,629
  • 1
  • 12
  • 6
  • Which type are `profile_pic` and `id` in your database? – ssantos Oct 08 '13 at 17:44
  • either change your `profile_pic` to `bigint` or a `varchar` - see http://stackoverflow.com/a/10255765/689579 or http://stackoverflow.com/a/17783238/689579 – Sean Oct 08 '13 at 17:44
  • `2147483647` it's the max int allowed in mysql, for example time() output this number `1381254130`, then when you add the id the result number is greater than the allowed for int in mysql, try with bigint instead int on mysql. remember store the file name without extension or change to vaarchar – Emilio Gort Oct 08 '13 at 17:45

1 Answers1

2
  1. get rid of profile_pic field in the table
  2. when uploading image, rename it to 'profile'.$id.'.jpg'
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345