Commas???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    Commas???

    Hello guys!
    I am trying to make something here,,,
    i am not an experienced php user so this might be an easy question but for
    me it seems like a mountain!
    So, i got a field in mySQL in which data is stored in this way:
    3,55,85,77,63,1 ,2,...,...,...
    which means, numbers seperated by commas.
    I need, when reading this field to get each number in a seperate variable or
    array...
    Can you help me out?
    With regards
    JBK


  • Ivan Marsh

    #2
    Re: Commas???

    On Sat, 26 Jul 2008 00:11:54 +0300, jbk wrote:
    Hello guys!
    I am trying to make something here,,,
    i am not an experienced php user so this might be an easy question but for
    me it seems like a mountain!
    So, i got a field in mySQL in which data is stored in this way:
    3,55,85,77,63,1 ,2,...,...,...
    which means, numbers seperated by commas.
    I need, when reading this field to get each number in a seperate variable or
    array...
    Can you help me out?
    With regards
    JBK
    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    --
    "Remain calm, we're here to protect you!"

    Comment

    • Alexander Fitzke

      #3
      Re: Commas???

      Ivan Marsh schrieb:
      On Sat, 26 Jul 2008 00:11:54 +0300, jbk wrote:
      >
      >Hello guys!
      >I am trying to make something here,,,
      >i am not an experienced php user so this might be an easy question but for
      >me it seems like a mountain!
      >So, i got a field in mySQL in which data is stored in this way:
      >3,55,85,77,63, 1,2,...,...,...
      >which means, numbers seperated by commas.
      >I need, when reading this field to get each number in a seperate variable or
      >array...
      >Can you help me out?
      >With regards
      >JBK
      >
      PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

      >


      use explode if you're not into regex..

      $array = explode(',',$st ring); will give you an array containing your
      values.

      good luck

      Comment

      • Guest's Avatar

        #4
        Re: Commas???

        Thanx guys, these did work fine!!!


        Ï <jbk@spotter.gr Ýãñáøå óôï ìÞíõìá
        news:g6dfit$r0g $1@ulysses.noc. ntua.gr...
        Hello guys!
        I am trying to make something here,,,
        i am not an experienced php user so this might be an easy question but for
        me it seems like a mountain!
        So, i got a field in mySQL in which data is stored in this way:
        3,55,85,77,63,1 ,2,...,...,...
        which means, numbers seperated by commas.
        I need, when reading this field to get each number in a seperate variable
        or array...
        Can you help me out?
        With regards
        JBK
        >

        Comment

        • Guest's Avatar

          #5
          Re: Commas???

          Thanx guys, these did work!!!
          ? "Alexander Fitzke" <cerveca@gmx.ne t?????? ??? ??????
          news:488a4c19$1 @news.uni-siegen.de...
          Ivan Marsh schrieb:
          >On Sat, 26 Jul 2008 00:11:54 +0300, jbk wrote:
          >>
          >>Hello guys!
          >>I am trying to make something here,,,
          >>i am not an experienced php user so this might be an easy question but
          >>for me it seems like a mountain!
          >>So, i got a field in mySQL in which data is stored in this way:
          >>3,55,85,77,63 ,1,2,...,...,.. .
          >>which means, numbers seperated by commas.
          >>I need, when reading this field to get each number in a seperate
          >>variable or array...
          >>Can you help me out?
          >>With regards
          >>JBK
          >>
          >http://us2.php.net/split
          >>
          >

          >
          use explode if you're not into regex..
          >
          $array = explode(',',$st ring); will give you an array containing your
          values.
          >
          good luck

          Comment

          • Jerry Stuckle

            #6
            Re: Commas???

            jbk@spotter.gr wrote:
            Hello guys!
            I am trying to make something here,,,
            i am not an experienced php user so this might be an easy question but for
            me it seems like a mountain!
            So, i got a field in mySQL in which data is stored in this way:
            3,55,85,77,63,1 ,2,...,...,...
            which means, numbers seperated by commas.
            I need, when reading this field to get each number in a seperate variable or
            array...
            Can you help me out?
            With regards
            JBK
            >
            >
            >
            Read up on database normalization. Then fix your database. It
            currently fails 1NF (first normal form), and this is just the beginning
            of your problems.

            For more help, ask in a newsgroup dedicated to your database.


            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • Geoff Berrow

              #7
              Re: Commas???

              Message-ID: <g6e46g$gbd$2@r egistered.motza rella.orgfrom Jerry Stuckle
              contained the following:
              >Read up on database normalization. Then fix your database. It
              >currently fails 1NF (first normal form), and this is just the beginning
              >of your problems.
              If he can't find explode() in the manual what chance does he have
              understanding normalisation? <grin>

              I think the OP may be better of leaving it as it is, as long as they
              realise that it may come back to bite them one day.
              --
              Geoff Berrow 011000100110110 0010000000110
              001101101011011 001000110111101 100111001011
              100110001101101 111001011100111 010101101011
              The Slippery Hill Boys Tel: 07985 425932. American themed barn dances and bluegrass performances. Stoke on Trent, Newcastle under Lyme, Staffordshire, Cheshire and surrounding areas.

              Comment

              • Jerry Stuckle

                #8
                Re: Commas???

                Geoff Berrow wrote:
                Message-ID: <g6e46g$gbd$2@r egistered.motza rella.orgfrom Jerry Stuckle
                contained the following:
                >
                >Read up on database normalization. Then fix your database. It
                >currently fails 1NF (first normal form), and this is just the beginning
                >of your problems.
                >
                If he can't find explode() in the manual what chance does he have
                understanding normalisation? <grin>
                >
                I think the OP may be better of leaving it as it is, as long as they
                realise that it may come back to bite them one day.
                No, it's always better to learn how to do things right. Doing things
                wrong will always cost you more time and money in the long run, and the
                longer you wait, the more time and money it will cost.

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                Working...