felipeebs Posted October 20, 2008 Share Posted October 20, 2008 my code is something like this: $value = "10-2008"; mysql_query("insert into editions(edition) values ($value)"); But it's not inserting "10-2008" in the table, is inserting "-1998" the "editions" table is id int(9) auto_increment, edition varchar(7) not null why is this happening? how to avoid? thank's Link to comment https://forums.phpfreaks.com/topic/129286-solved-mysql-is-a-crazy-thing/ Share on other sites More sharing options...
rhodesa Posted October 20, 2008 Share Posted October 20, 2008 it's evaluating it as a number. wrap it in single quotes: $value = "10-2008"; mysql_query("insert into editions(edition) values ('$value')"); Link to comment https://forums.phpfreaks.com/topic/129286-solved-mysql-is-a-crazy-thing/#findComment-670263 Share on other sites More sharing options...
felipeebs Posted October 20, 2008 Author Share Posted October 20, 2008 oh lord! thank's ^^ Link to comment https://forums.phpfreaks.com/topic/129286-solved-mysql-is-a-crazy-thing/#findComment-670269 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.