Jump to content

mysql error


garydt

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/56183-mysql-error/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/56183-mysql-error/#findComment-277510
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.