SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Substring_index

  1. #1
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Substring_index

    Whit the help of Rudy I could output a first Paragraph from a long text using:

    Code MySQL:
      SUBSTRING_INDEX( product_description, CHAR(13,10), 1) AS first_paragraph

    For a multiple language site I needed to change that into:

    Code MySQL:
    SUBSTRING_INDEX( product_description_eng, CHAR(13,10),1) AS first_paragraph_eng
    SUBSTRING_INDEX( product_description_gre, CHAR(13,10),1) AS first_paragraph_gre
    SUBSTRING_INDEX( product_description_dut, CHAR(13,10),1) AS first_paragraph_dut

    and so on. But now can't I get just the first paragraph to display? I quess it has to do with the CHAR(13,10) but I'm not sure. Can someone please explain what I'm doing wrong and if it indeed has to do with the CHAR(13,10) part of the SUBSTRING_INDEX, please explain me the working of that part

    Thank you in advance.
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,273
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by donboe View Post
    Wh I quess it has to do with the CHAR(13,10) but I'm not sure.
    no, it doesn't
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by donboe View Post
    But now can't I get just the first paragraph to display?
    Do you get an error, or what?

  4. #4
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    Do you get an error, or what?
    no no error it just shows the entire text
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •