$username Posted October 5, 2007 Share Posted October 5, 2007 Hello guys and girls, I am having issue with they way that my PHP MYSQL code works with the MYSQL version 5.0.45 Here is the Code that inserts the data into the database. The thing is the tables that have a int in MYSQl error when there is no value present. <?php } else { $FirstName = $_POST['FirstName']; $LastName = $_POST['LastName']; $AddressStreet = $_POST['AddressStreet']; $AddressCity = $_POST['AddressCity']; $AddressState = $_POST['AddressState']; $AddressZip = $_POST['AddressZip']; $CaseNotes1 = $_POST['CaseNotes1']; $CaseNotes2 = $_POST['CaseNotes2']; $CaseNotes3 = $_POST['CaseNotes3']; $CaseNotes4 = $_POST['CaseNotes4']; $OtherInfo = $_POST['OtherInfo']; $ServBy = $_POST['ServBy']; $Paid = $_POST['Paid']; $Amount = $_POST['Amount']; $ClientName = $_POST['ClientName']; $ServDate = $_POST['ServDate']; $County = $_POST['County']; $query33 = ("INSERT INTO `store` (FirstName, LastName, AddressStreet, AddressCity, AddressState, AddressZip, CaseNotes1, CaseNotes2, CaseNotes3, CaseNotes4, OtherInfo, ServBy, Paid, Amount, ClientName, County, ServDate) VALUES ('$FirstName', '$LastName', '$AddressStreet', '$AddressCity', '$AddressState', '$AddressZip', '$CaseNotes1', '$CaseNotes2', '$CaseNotes3', '$CaseNotes4', '$OtherInfo', '$ServBy', '$Paid', '$Amount', '$ClientName', '$County', '$ServDate')"); $insert_res = @mysql_query($query33) or die(mysql_error()); echo "Your Info Has Been Added "; } mysql_close($conn); ?> Database structure Field Type Collation Attributes Null Default AddressZip smallint(10) No What would make this happen. should I add that if there is no value present to make it 0? Thank you, Brett Quote Link to comment https://forums.phpfreaks.com/topic/71972-solved-mysql-php-code-works-with-older-version/ Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 should I add that if there is no value present to make it 0? knowing nothing else, yes. can you echo the SQL that causes the problem and paste the MySQL error? Quote Link to comment https://forums.phpfreaks.com/topic/71972-solved-mysql-php-code-works-with-older-version/#findComment-362536 Share on other sites More sharing options...
$username Posted October 5, 2007 Author Share Posted October 5, 2007 Incorrect integer value: '' for column 'AddressZip' at row 1 Brett Quote Link to comment https://forums.phpfreaks.com/topic/71972-solved-mysql-php-code-works-with-older-version/#findComment-362552 Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 should I add that if there is no value present to make it 0? knowing nothing else, yes. can you echo the SQL that causes the problem and paste the MySQL error? Quote Link to comment https://forums.phpfreaks.com/topic/71972-solved-mysql-php-code-works-with-older-version/#findComment-362555 Share on other sites More sharing options...
$username Posted October 5, 2007 Author Share Posted October 5, 2007 I got it to work. I have SQl just add a default value if there is not a value. Thanks, Brett Quote Link to comment https://forums.phpfreaks.com/topic/71972-solved-mysql-php-code-works-with-older-version/#findComment-362636 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.