First, huge thanks for the help on my previous question. You guys solved my problem.
Here is a different one. I have a prepared statement with INSERT INTO. Only, it’s not creating the new row. I’ve tried using try/catch to isolate the error, but the catch isn’t giving me anything. I’ve also been using fwrite to track the value of things as the code progresses, and I know roughly where the code just stops running, I just can’t figure out why. The third fwrite line runs smoothly, but as far as I can tell, nothing happens after that. The new row does not get written, but the fwrite line within the catch does not execute either.
Here is the function. I had trouble getting code to indent properly last question I posted, so I took a screenshot of the function this time instead:
One thing that’s not an error above: The column Number is actually a string, that’s why it has bindValue instead of BindParam and no PDO::PARAM_INT. It’s a string because it may be a number or it may be of the form “3d6+3” or something like that.
Here is the result of all the fwrite, which is exactly the data I expect it to produce:
0, 0, 60, 2d6
New Index = 1.
PDOStatement Object
(
[queryString] => INSERT INTO treasure (Index, MonsterID, ItemID, Frequency, Number) VALUES (:index, :monsterid, :itemid, :frequency, :number)
)
Finally, here’s a screen grab of the phpMyAdmin panel showing the table with column names and data, just to eliminate any chance that I’ve mis-typed a column name somewhere. The one row of data in this table I entered manually through phpMyAdmin, so that I could have data to use when testing a different function to display the table contents.