Jump to content

Recommended Posts

Hi

 

I would be ever so grateful if there is a PHP / MYSQL genius out there that can solve this annoying issue I have

 

I have a member site with just 3 test members at present. Where users can simply send and receive internal messages to each other. The messaging system works to a fashion. However when a user goes to send a message to another user the following error occurs;

 

Database error: Invalid SQL: insert into sky_message (to_id,from_id,subject,message,send_date) values('1','3','testy','another test',now())
MySQL Error: 1062 (Duplicate entry '1' for key 1)
Session halted.

 

Database error: Invalid SQL: insert into sky_message (to_id,form_id,subject,message,send_date) values('4','2','test','another test',now())
MySQL Error: 1062 (Duplicate entry '2' for key 2)
Session halted.

 

Database error: Invalid SQL: insert into sky_message (to_id,form_id,subject,message,send_date) values('3','2','test','again',now())
MySQL Error: 1062 (Duplicate entry '3' for key 1)
Session halted.

 

 

Within mysql table called sky_member

 

I have set member id to int(5) and there are currently 3 members with member_id as primary key with auto_increment 1,2,3 (1 for 1st member, 2 for second and so forth)

 

table called sky_message

 

The problem is there is a sky_message table with fields; to_id, from_id and msg_id.

These values are conflicting with the member_id value within the sky_member table.

 

Please help solve this one? I have attached screen shots of both tables

 

mesageissues2.doc

Link to comment
https://forums.phpfreaks.com/topic/281355-mysql-php-problem-reading-sent-messages/
Share on other sites

You have your to_id and/or from_Id columns marked as being unique. You need to remove this constraint.

 

Also, you posted in the form for Microsoft SQL Server, but you are using Mysql. They are completely different database packages. I've moved your thread for you, please pay attention to where you post in the future.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.