开发者

Intermittent INSERT failure to mysql table

开发者 https://www.devze.com 2023-02-04 16:25 出处:网络
Simple php/mysql INSERT such as mysql_query(\"INSERT INTO dispatch VALUES(\'1234\',\'$name\',\'$address\')\");

Simple php/mysql INSERT such as

mysql_query("INSERT INTO dispatch VALUES('1234','$name','$address')");

intermittently fails. I've set it up to trap when it happens and put the user back onto the form with the re-populated data so they can try again, however once it开发者_开发问答 fails, it will never insert. I've tried re-establishing the connections, creating a new connection, I'm at a total loss here. Anybody have any ideas?

UPDATE

Result of DESCRIBE dispatch

 ticketnum int(11) NO PRI auto_increment 
 callername tinyblob NO
 callerphone tinyblob YES 
 request longblob YES 
 clientname tinyblob NO 
 callcounty varchar(30) YES 
 clientphone tinyblob YES 
 dispatcher varchar(30) NO 
 dispatched varchar(3) NO
 rectime datetime NO
 dispatchtime datetime YES
 timetodispatch time YES
 worker varchar(30) YES
 restime datetime NO
 timetores time NO
 resolution varchar(120) NO
 notes longblob YES 
 recordnum varchar(15) YES 
 dob date YES

EDITED TO ADD:

I found it. My first hint was here. Apparently, MySQL 5.1.49 has some stability issues in conjunction with Debian (I'm using Ubuntu Server). Further searching after this hint describes some very similar situations. Currently, I'm reconfiguring and installing MySQL 5.0.51. Hopefully, this will help put a stop to the nonsense :)

Thanks to you all for your help!


Are you using persistent connections to the DB? Maybe the issue lies in the connection method to your DB and not the actual INSERT statement. Have you checked your MYSQL/SYS logs?

To clarify, usually your MYSQL log would be in /var/log/mysql or related area (this example is for a linux debian system, will vary for your system).

This are least lets you see IF there are any mysql errors, ie run out of resources, etc;


You may need to try this

put your field name into the query:

mysql_query("INSERT INTO dispatch(ticketnum,callername,...) VALUES('1234',$name,$address)");

I am assuming the $name and $address are variables. from this query above align the field names with values you want to insert. like the way i have here will not work for sure, cos you have the int(11) and String type mismatch, ticketnum is autogenerated value, change accordingly to fit your requirments...

create a stored stored procedure, that will make things easy ..


I found it. My first hint was here. Apparently, MySQL 5.1.49 has some stability issues in conjunction with Debian (I'm using Ubuntu Server). Further searching after this hint describes some very similar situations. Currently, I'm reconfiguring and installing MySQL 5.0.51. Hopefully, this will help put a stop to the nonsense :)

Thanks to you all for your help!

0

精彩评论

暂无评论...
验证码 换一张
取 消