first insert works, second doesn't even though only a light difference
hey everyone,
Ive been having trouble with this bit of code, the first insert works fine, however, the second doesnt insert at all, even though there is only 2 differences, those being instead of 1 on the type, its a 2 and on the length, instead of being a 0 its a generated number:
I assumed as well that you have determined that it even enters that conditional block?
Print out the $sqlinsertban and make sure you give it conditions to enter that conditional. When it does, take that and run that in the SQL client to verify that it works.
i have tested it, over and over, i just made it print what it was trying to process and this is what i got:
Code:
INSERT INTO `banned` (`username`, `by`, `type`, `reason`, `length`) VALUES ('BFR' , 'DOS1392' , '2' , 'test ban works 2' , '1361393385')
however, it doesnt actually insert into the database, but changes the overhead value in the database table to a higher value, if that makes any difference?
And when you run that in the client it produces no insertion and no error?
Your resulting query doesn't match what you have here either. You have hardcoded entries for the fifth parameter, but in the result you have a string which appears to be a timestamp. Which begs the question though as to why that's a text datatype.
If you get no error and the record doesn't appear, something is wrong with your MySQL server. It needs to reply with something, either a successful insertion or a failure notice.
The overhead in PHPMyAdmin isn't relevant to this query, but it is affected by update and deletions and will affect searching. Running an OPTIMIZE query will resolve that. That refers to the empty space caused by the deletion of records or drastic alterations on an update. Insertions I don't believe have any affect on the overhead, though I could be wrong.
when running the second insert in the mysql server, it says its successful, however, it does not insert into the database.
The reason its hard coded in the first insert is because its ment to just be a 0, so yes i could change it to leave it at default, if thats what you mean?
but as for why its not working, ive tried changing from varchar to int, and that stil didnt work, however if i change out $total in the second query, and put in any other number for example "2" it will insert fine :S
I'm not talking about the 0, I'm talking about the 100.
How many records does PHP state has been entered? Also, you've checked that its not paged beyond the default 30 records I think it is that PHPMyAdmin shows?
o i am very sorry, the 100 isnt the correct part of code, i do believe i have lead you slightly astray with that, where that 100 is it should be $total: this is my new update code, however, this has the same problem on the second insert, however if i change $total to a number, it works, its just when its $total it doesnt:
How are you checking to see if records are inserted? You're actually issuing a select query for them (not relying on PHPMyAdmin overview) right?
You can verify the number of inserted rows. PHPMyAdmin or a client will return that directly and PHP can pull using mysql_affected_rows. Do these show that one record has been inserted?
i am checking in php my admin (should i not be?) it does not show up on there, however, when i run the first insert afterwards, the auto inc jumps one, for example it could start on 1, that 1 works, then the second one doesnt because its the 2nd insert query, then if i try the first query again the auto inc will be 3 not 2, if that make sense
Yeah your fine then. Issue a SELECT statement instead; sounds to me that you have filtering in place on the output table that only checks for a specific enum type.
MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0002 sec )
i ran your string and that came up, so in answer, yes the result set is empty, even though i have not deleted anything yet, and it is less than 30 in the result by the way.