andy_pleasants's Profile User Rating: -----

Reputation: 39 Craftsman
Group:
Active Members
Active Posts:
118 (0.11 per day)
Joined:
08-July 10
Profile Views:
1,938
Last Active:
User is offline Apr 29 2013 02:22 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
0
Icon   andy_pleasants has not set their status

Posts I've Made

  1. In Topic: Connecting to Mysql database problem

    Posted 29 Apr 2013

    I think this is more of a .NET related problem than a MySQL problem. The error says it can't load the required assembly, you might have more look on the .NET board
  2. In Topic: Designing a proper Message Table

    Posted 17 Mar 2013

    Quote

    The apostrophes shouldn't be present in the above snippet.
    correct, I was doing that on my tablet, and didn't notice it had auto-corrected to that.
  3. In Topic: Designing a proper Message Table

    Posted 16 Mar 2013

    Hi again, I've just found this article which is related to your question.

    It basically uses the method you were attempting, and which I now believe to be a better method (contrary to my last comment), especially for high usage, multi user systems.
  4. In Topic: Designing a proper Message Table

    Posted 2 Mar 2013

    Hi

    Just to be clear, you want to return the last 20 messages in a conversation between 2 users?

    If so you're just missing a few SQL constructs, I think this should work:

    SELECT *
    FROM member_messages
    WHERE
    (
    (
    message_from = userid
    AND
    message_to = friendid
    )
    OR
    (
    message_from = friendid
    AND
    message_to = usetid
    )
    )
    AND message_I'd <= upperid
    ORDER BY message_I'd DESC
    LIMIT 20
    
    


    This will gather messages from user A to user B or user B to user A, where the message is is less than the specified upperid, order them by the message is (highest and therefore latest first) and then take only the first (or because of the sorting latest) 20.

    Also if you're trying to implement some sort of paging here the LIMIT construct can take 2 parameters, when you pass 2 parameters the first is how many rows to skip and the second is how many to take so LIMIT 0 20 will skip 0 and take 20 (I.e. the first 20)
  5. In Topic: Deleting a row when a row from another table is deleted.

    Posted 27 Jan 2013

    Hi guys

    I think the best way to achieve this is by setting the
    ON DELETE
    
    option on the foreign key constraint to
    CASCADE
    
    .

    This will automatically delete all the referencing rows when the parent row is deleted - no need for extra programming or triggers

My Information

Member Title:
D.I.C Head
Age:
27 years old
Birthday:
February 4, 1986
Gender:
Full Name:
Andrew Pleasants
Years Programming:
3
Programming Languages:
C#, Java, PHP, ASP.NET

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

Page 1 of 1
  1. Photo

    macosxnerd101 Icon

    16 Mar 2011 - 15:13
    Sorry about the accidental downvote there. :(
Page 1 of 1