#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    Is there a way to remove characters from a VARCHAR variable?

    Take the $year variable. In my database the year is stored as a 4 character VARCHAR. I want to process the variable so that the first two characters are discarded, leaving me with a two character variable.

    $year = '1988'

    &newyear = $year - first two characters

    $newyear = '88'

    Can this be done?

    Thanks,
    Mike

    [This message has been edited by mstembri (edited August 28, 2000).]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Washington, USA
    Posts
    52
    Rep Power
    14
    Check the function SUBSTRING in SQL:

    SUBSTRING('1988', 2, 2) returns "88"



    ------------------
    <UL TYPE=SQUARE>
    <LI> TD Scripts
    <LI> Script School
    <LI>php-scripts
    </UL>

Similar Threads

  1. A variable $_POST variable?
    By CLuver in forum PHP Development
    Replies: 0
    Last Post: February 11th, 2004, 12:55 AM
  2. syntax error
    By DQSJR in forum MySQL Help
    Replies: 2
    Last Post: December 31st, 2003, 01:28 PM
  3. Split a variable by characters.
    By boardhigh in forum PHP Development
    Replies: 2
    Last Post: November 17th, 2003, 01:49 PM
  4. Replies: 5
    Last Post: November 16th, 2003, 11:31 AM
  5. Replies: 4
    Last Post: November 11th, 2003, 12:55 PM

IMN logo majestic logo threadwatch logo seochat tools logo