/    Sign up×
Community /Pin to ProfileBookmark

MySQL server has gone away; Can you help?

Hi All, I keep my emails in my database which are fetched using php_imap. At the minute they are put onto the db using my 1&1 account and this poses no problem.

I am however moving away from the 1&1 account to localhost so that I can eventually downgrade my 1&1 account. The inbox looks like this.

[CODE]+————-+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+————-+——————+——+—–+———+—————-+
| message_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| header | text | YES | | NULL | |
| header_info | text | YES | | NULL | |
| structure | text | YES | | NULL | |
| from_name | varchar(100) | NO | | NULL | |
| from_email | varchar(255) | NO | MUL | NULL | |
| tel | varchar(50) | YES | | NULL | |
| time | datetime | NO | | NULL | |
| subject | varchar(255) | YES | | NULL | |
| text | longtext | NO | MUL | NULL | |
| html | longtext | YES | MUL | NULL | |
| attachments | longtext | YES | | NULL | |
| read | enum(‘y’,’n’) | NO | | n | |
| downloaded | enum(‘y’,’n’) | NO | | n | |
| follow_up | enum(‘y’,’n’) | NO | | y | |
| replied | datetime | YES | | NULL | |
+————-+——————+——+—–+———+—————-+[/CODE]

I should mention that the `tel` field is taken from a feedback from on the website that also goes into the inbox.

The INSERT looks like this

[code=php]sprintf(“INSERT INTO `inbox` SET `structure` = ‘%s’, `header` = ‘%s’, `header_info` = ‘%s’, `text` = ‘%s’, `html` = ‘%s’, `attachments` = ‘%s’, `from_email` = ‘%s’, `from_name` = ‘%s’, `subject` = ‘%s’, `time` = DATE_SUB(FROM_UNIXTIME(%u), INTERVAL 1 HOUR);”,
mysql_real_escape_string($s_structure),
mysql_real_escape_string($s_header),
mysql_real_escape_string($s_header_info),
mysql_real_escape_string(TEXT),
mysql_real_escape_string(HTML),
mysql_real_escape_string($atts),
mysql_real_escape_string($from_email),
mysql_real_escape_string($from_name),
mysql_real_escape_string($subject),
mysql_real_escape_string($header_info->udate));[/code]

The result INSERT when echoed comes out as
[URL=”http://www.forcesresources.co.uk/mysql_dump.php”]http://www.forcesresources.co.uk/mysql_dump.php[/URL]

This bring up the MYSQL Server has gone away error.
The file is only 761 Kb and so I cannot see a problem as files fit into the 1&1 database and the structure has been taken from a mysql_dump.

The insert works fine without base64 file attachments.

Any suggestions welcome as I am by no means an expert on MYSQL;

Thanks in advance

John Evans

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@chazzyApr 23.2009 — when do you create the mysql connection? mysql_real_escape_string requires a mysql connection.
Copy linkTweet thisAlerts:
@postedoverseasauthorApr 23.2009 — Hi Chazzy, thanks for your time. The connection is created at the top of the page. If it helps I can post the entire page. I though that the connection was ok as it insert ok when there are no base64 attachments to add.

If you need the page putting up here or any more info please ask.

Thanks again.
×

Success!

Help @postedoverseas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...