Updating but not inserting on the database php

Rated 3.99/5 based on 731 customer reviews

I then echo the query, and test it with mysqladmin or other sql tool.

But, when it comes to mysql errors - when something is not providing me an error properly (when debugging that looks like this) - I read line by line.

My issue with INSERT INTO categories is that its never inserting data into the table and there is no error. And worse, on a remote, identical, database the same code was working.

I am using almost the same query in code with a different table and there it's working. The solution was to define a default value (any value) to all the database fields... i have been stuck in this problem for a long time the only solution i found is use mysqli instead of mysql because in newer versions of php these mysql has been deprecated for example use the following methods and make sure keep the order correct dirst the variable e.g '$conn' and then database name in the method 'mysqli_select_db($conne,'checksum');'.

Pasting this query into the My SQL command line, or into php My Admin works just fine - the record is inserted.

Your code is working just fine, The issue here is the database auto increment was not set. you will not be able to insert additional records beyond one no matter how many times you run your script.I have same issue is not sintax, I am fixing the table but more than one table corrupt? I suspect if php My Admin works, we should respct alternative answer: INSERT INTO `my_db`.`record_collection` SET `record_id`='$id',... Fixing may work after an attack or something but if you are on innodb you just run the the query alter table t1 force; If nothing works I am changing into insert delayed or insert ignore to test if it changes some instruction.and I do get no errors, neither bad intentional sql. Maybe is an empty value on an index or something but that gives an error.The record is not pulled back on the PHP page where it should be displayed, which leads me to believe the record is not actually inserted.If I paste in the generated query manually to create the record, it is listed on my page, but if I leave it to the above mysql_query() call, it doesn't appear on the page. PHP has no knowledge of whether the My SQL engine is still running a thread.

Leave a Reply