Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.