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.

Remove what's after a comma

Discussion in 'MySQL' started by Fracisc, Apr 14, 2015.

  1. #1
    Fracisc, Apr 14, 2015 IP
    SEMrush
  2. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,635
    Likes Received:
    394
    Best Answers:
    21
    Trophy Points:
    295
    #2
    Nigel Lew, Apr 15, 2015 IP
  3. jestep

    jestep Prominent Member Premium Member

    Messages:
    3,634
    Likes Received:
    212
    Best Answers:
    18
    Trophy Points:
    330
    #3
    A regular expression would work in addition to the above method.
     
    jestep, Apr 16, 2015 IP
  4. ezfile

    ezfile Greenhorn Affiliate Manager

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #4
    If you are using php

    $string = 'http://www.test.com/imga1.php, http://www.test.com/imga2.php';
    $string_arr = explode(','. $string );
    $first = $string_arr[0];

    Not sure why you want to do this in mysql or storing data like that in mysql...
     
    ezfile, Apr 20, 2015 IP
  5. Amelie001

    Amelie001 Greenhorn

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    you can use SUBSTRING_INDEX(str,delim,count) function with update query
     
    Amelie001, May 26, 2016 IP