techtheatre Posted May 3, 2007 Share Posted May 3, 2007 My PHP code is submitting the following query (i have even done it manually in phpMyAdmin): INSERT INTO ValuesTemp ( CdId , InvId , CustomerId , CardPart , Month , Year, CreationDate ) VALUES (NULL , '3' , '' , '12345678901' , '07' , '2007', now() ); The table structure is: CREATE TABLE `ValuesTemp` ( `CdId` int(10) NOT NULL auto_increment, `InvId` int(10) NOT NULL default '0', `CustomerId` int(10) NOT NULL default '0', `CardPart` int(20) NOT NULL default '0', `Month` int(2) NOT NULL default '0', `Year` int(4) NOT NULL default '0', `CreationDate` date NOT NULL default '0000-00-00', `CompletionDate` date NOT NULL default '0000-00-00', PRIMARY KEY (`CdId`) ) TYPE=MyISAM AUTO_INCREMENT=4 ; All the values seem to be storing correctly except that for some reason the value for "CardPart" keeps showing up in the database as 2147483647 What am i doing wrong? :-\ This is very strange (i think). Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/49738-solved-posted-value-is-being-changedwierd/ Share on other sites More sharing options...
quillspirit Posted May 3, 2007 Share Posted May 3, 2007 Have you tried passing it to the query as a variable? $test = '12345678901'; INSERT INTO ValuesTemp ( CdId , InvId , CustomerId , CardPart , Month , Year, CreationDate ) VALUES (NULL , '3' , '' , '$test' , '07' , '2007', now() ); Does it show up as that number no matter what value you try to Insert CardPart is? Quote Link to comment https://forums.phpfreaks.com/topic/49738-solved-posted-value-is-being-changedwierd/#findComment-243941 Share on other sites More sharing options...
techtheatre Posted May 3, 2007 Author Share Posted May 3, 2007 yes...i have passed it several ways and also had the sql string echoed to the screen so i could read it myself...each time the input number (12345678901) becomes 2147483647 once it is in the DB table. I have even used phpMyAdmin to insert the correct query, and even then it says that it was "successful" but when i look at it the numbers are wrong... ??? Quote Link to comment https://forums.phpfreaks.com/topic/49738-solved-posted-value-is-being-changedwierd/#findComment-243946 Share on other sites More sharing options...
quillspirit Posted May 3, 2007 Share Posted May 3, 2007 Have you tried: CHECK TABLE 'ValuesTemp' Quote Link to comment https://forums.phpfreaks.com/topic/49738-solved-posted-value-is-being-changedwierd/#findComment-243950 Share on other sites More sharing options...
techtheatre Posted May 3, 2007 Author Share Posted May 3, 2007 i just did...and it says the table is fine...there are only 4-5 entries so far...as i have just started this table and am stil writing the scripts... Quote Link to comment https://forums.phpfreaks.com/topic/49738-solved-posted-value-is-being-changedwierd/#findComment-243977 Share on other sites More sharing options...
bubblegum.anarchy Posted May 3, 2007 Share Posted May 3, 2007 The INT signed range is -2147483648 to 2147483647, try a BIGINT instead wth a signed range of -9223372036854775808 to 9223372036854775807 Quote Link to comment https://forums.phpfreaks.com/topic/49738-solved-posted-value-is-being-changedwierd/#findComment-243984 Share on other sites More sharing options...
techtheatre Posted May 3, 2007 Author Share Posted May 3, 2007 Thanks! I knew it was something with the table as i had checked everything else...glad to know the limitations on INT. I always wondered when to use one type over another. This solved the problem! Quote Link to comment https://forums.phpfreaks.com/topic/49738-solved-posted-value-is-being-changedwierd/#findComment-244323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.