1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MySQL help with error

Discussion in 'MySQL' started by ianhaney, Jan 16, 2013.

  1. #1
    Hi all


    I am sort of new to MySQL


    I have installed a script on my website and need help with the following if ok


    my wife created a account and used a few capital letters and a space in her username and logged in all ok and the page is where to write status updates and where a share button is, I am getting the following error, it only happens when capital letters and spaces are used


    How would I go about fixing it please


    Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's' ORDER BY messages_id DESC' at line 1


    Thank you in advance, I can paste any coding or give the website address if need be to look at


    Thanks in advance


    Ian
     
    ianhaney, Jan 16, 2013 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    Paste the SQL query.
     
    Rukbat, Jan 17, 2013 IP
  3. ianhaney

    ianhaney Greenhorn

    Messages:
    72
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #3
    Hi

    Thank you so much for the reply Rukbat

    This is the SQL query

    $query = "SELECT*UNIX_TIMESTAMP() - date_created AS TimeSpent FROM message WHERE poster='".$_SESSION['SESS_FIRST_NAME'] . "' ORDER BY messages_id DESC";
    echo $query; exit();
    $result = mysql_query($query);

    Is that what you need

    Ian
     
    ianhaney, Jan 17, 2013 IP
  4. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #4
    Is this copy/pasted or did you type it here?

    SELECT*UNIX_TIMESTAMP()

    Needs a couple of spaces and a comma:

    SELECT *, UNIX_TIMESTAMP()
     
    Rukbat, Jan 17, 2013 IP