garydt Posted June 19, 2007 Share Posted June 19, 2007 I get error - Column 'bigcaption' cannot be null when the user doesn't input anything for this field. Yet I've got other fields setup exactly the same and they work. I've tried setting 'bigcaption' to null and not null. both give the error. mysql_select_db($database_elvisdb, $elvisdb); $insertSQL = sprintf("INSERT INTO images (imageName, bigimagename, usnm, bigcaption) VALUES ('$smallimage', '$smallpics', '$user', %s)", GetSQLValueString($_POST['textfield'], "text")); $Result1 = mysql_query($insertSQL, $elvisdb) or die(mysql_error()); mysql_select_db($database_elvisdb, $elvisdb); Quote Link to comment https://forums.phpfreaks.com/topic/56183-mysql-error/ Share on other sites More sharing options...
MasterACE14 Posted June 19, 2007 Share Posted June 19, 2007 See if this fixes the problem, just replace your current line with this one. $insertSQL = sprintf("INSERT INTO images (imageName, bigimagename, usnm, bigcaption) VALUES ('$smallimage', '$smallpics', '$user', '%s')", if that doesn't work try this line. but you will need a $caption variable for this line of coding. $insertSQL = sprintf("INSERT INTO images (imageName, bigimagename, usnm, bigcaption) VALUES ('$smallimage', '$smallpics', '$user', '$caption')", Good luck. Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/56183-mysql-error/#findComment-277510 Share on other sites More sharing options...
garydt Posted June 19, 2007 Author Share Posted June 19, 2007 The first 1 worked. Thanks alot. Quote Link to comment https://forums.phpfreaks.com/topic/56183-mysql-error/#findComment-277602 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.