I added two new fields to a table. The SQL insert into
continues to work for the two old fields, but fails to insert any data for the two new fields. The two new fields are $authorflag
and $artistflag
. These two fields are supposed to be boolean
variables.
I have experimented by changing these variables from integer
to string
, changing their position, and even re-creating the table so that all four fields are new. Despite these tweaks, only the two old variables are actually inserted into the table. The new variables show-up as null
.
$authorflag='NNNNNNNN';
$artistflag=0;
login();
$stmt=$conn->prepare('INSERT INTO tblAuthorList (AuthorLast,AuthorFirst,AuthorFlag,ArtistFlag) Values(?,?,?,?)');
$stmt->bind_param('sssi', $lastname,$firstname,$authorflag,$artistflag);
$stmt->execute();
Issue solved. The code was correct. The problem was accidentally cross-linking two forms. I have two versions of my database one for production and one for testing. I had combined two tables into one (on both versions) and was correspondingly modifying the associated forms.
Thank you for providing feedback. Getting the thoughts of others is very useful. Happy New Year.