2

我正在尝试在 php 和 mysql 中做一个小应用程序。

问题: 数据库损坏,我随机丢失数据。总是丢失的数据是事务的一部分,绝不是完整的事务,只是事务的一部分。

关于应用程序的信息: Wampserver 用于 Windows 7 机器上的基本设置。该机器是个人桌面。该应用程序不会在线托管,它将始终在本地服务器上运行。

这是 mysql 日志的一部分

121108 19:19:57 [Note] wampmysqld: ready for connections.
Version: '5.5.24-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
121109 10:09:56 [Note] Plugin 'FEDERATED' is disabled.
121109 10:09:56 InnoDB: The InnoDB memory heap is disabled
121109 10:09:56 InnoDB: Mutexes and rw_locks use Windows interlocked functions
121109 10:09:56 InnoDB: Compressed tables use zlib 1.2.3
121109 10:09:56 InnoDB: Initializing buffer pool, size = 128.0M
121109 10:09:56 InnoDB: Completed initialization of buffer pool
121109 10:09:56 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
121109 10:09:56  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Last MySQL binlog file position 0 659637, file name .\mysql-bin.000056
121109 10:09:58  InnoDB: Waiting for the background threads to start
121109 10:09:59 InnoDB: 1.1.8 started; log sequence number 6158775
121109 10:09:59 [Note] Recovering after a crash using mysql-bin
121109 10:09:59 [Note] Starting crash recovery...
121109 10:09:59 [Note] Crash recovery finished.
121109 10:09:59 [Note] Server hostname (bind-address): '(null)'; port: 3306
121109 10:09:59 [Note]   - '(null)' resolves to '::';
121109 10:09:59 [Note]   - '(null)' resolves to '0.0.0.0';
121109 10:09:59 [Note] Server socket created on IP: '0.0.0.0'.
121109 10:09:59 [Note] Event Scheduler: Loaded 0 events
121109 10:09:59 [Note] wampmysqld: ready for connections.
Version: '5.5.24-log'  socket: ''  port: 3306  MySQL Community Server (GPL)

这是我正在使用的代码 - PHP CODE

请注意 :

  • 我不确定这是我的代码还是其他问题。
  • 代码不好,这是我第一次写超过 2 行的 PHP。
  • 需要检查的代码是从第11行到第198行
  • 丢失数据的 mysql 查询位于第 176 行

任何帮助表示赞赏。

4

0 回答 0