hisher Posted December 20, 2008 Share Posted December 20, 2008 I have a table "text" with attributes: old_id int( 8 ) auto_increment old_text mediumblob old_flags tinyblob When I execute the query : INSERT INTO `text` (old_id,old_text,old_flags) VALUES (NULL,'aa','utf-8') I found the Autoindex in the table increased. I double checked with mysql_error(print no error) and mysql_affected_rows(the value is 1). However, the problem is the inserted tuple did not appear in the database. I found the maximum 'old_id' does not changed, no tuple with text 'aa'. The syntax of sql should be fine. I checked with phpMyAdmin and the tuple is successfully inserted and displayed in the database. Anyone knows what could cause this problem? I am very confused and thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/137769-very-strange-mysql_query-can-not-write/ Share on other sites More sharing options...
hisher Posted December 20, 2008 Author Share Posted December 20, 2008 I added : mysql_query('commit'); It can successfully insert the tuple into the database. However, it caused other problems for my project. What's the difference if I don't add the commit sql command? Why will it cause this situation? Quote Link to comment https://forums.phpfreaks.com/topic/137769-very-strange-mysql_query-can-not-write/#findComment-720150 Share on other sites More sharing options...
corbin Posted December 20, 2008 Share Posted December 20, 2008 It looks like you're using transactions. How did you manage to use transaction without realizing it??? Quote Link to comment https://forums.phpfreaks.com/topic/137769-very-strange-mysql_query-can-not-write/#findComment-720154 Share on other sites More sharing options...
hisher Posted December 20, 2008 Author Share Posted December 20, 2008 Actually I am using the open source "mediawiki" to support wiki platform. I traced to the code where the sql query is executed and made the above tests. But obvisouly, I have no big picture of how the whole project's transaction is handled. Quote Link to comment https://forums.phpfreaks.com/topic/137769-very-strange-mysql_query-can-not-write/#findComment-720162 Share on other sites More sharing options...
hisher Posted December 20, 2008 Author Share Posted December 20, 2008 Meanwhile, at the place I traced, I added the code to insert into a new-created test table. Without the "Commit", the tuple is still successfully inserted. So is the previous `text` table more special? Why it needs 'commit'? Quote Link to comment https://forums.phpfreaks.com/topic/137769-very-strange-mysql_query-can-not-write/#findComment-720167 Share on other sites More sharing options...
fenway Posted December 22, 2008 Share Posted December 22, 2008 Tables can't "need" commit... transactions exist on the statement level. Quote Link to comment https://forums.phpfreaks.com/topic/137769-very-strange-mysql_query-can-not-write/#findComment-721566 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.