strtolower wont do his job

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kristof Goossens

    strtolower wont do his job

    Hi you guys,

    in the following insert the strtolower wont put the chars in lowercase.
    Any ideas what i'm doing wrong?

    the code:

    $qryInsRel = "INSERT INTO \"tblrelations\ " (rid, vcfirstname,
    vclastname, vccompany, vcfunction, nlangid, ngenderid, nuserid,
    ntitleid, dtbirthdate, vcbankaccount, vcvatnr, vctraderegister nr)
    VALUES(" . $relNextVal .", '" . $_POST["txtFirstNa me"] . "', '" .

    strtolower($_PO ST["txtLastNam e"])

    .. "', '" . $_POST["txtCompany "] . "', '" . $_POST["txtFunctio n"] . "',
    '" . $_POST["txtLanguag e"] . "', '" . $_POST["txtGender"] . "', '" .
    $_COOKIE["cUserID"] . "', '" . $_POST["txtTitle"] . "', '" . $bday .
    "', '" . $_POST["txtBankaccount "] . "', '" . $_POST["txtVATNr"] . "',
    '" . $_POST["txtTradeRe gNr"] . "')";

    (btw i moved a bit from the layout of the code but the rest is exactly
    what i have)


    thx in advance,

    kristof
  • Andy Hassall

    #2
    Re: strtolower wont do his job

    On Tue, 23 Dec 2003 21:15:21 +0100, Kristof Goossens <newsgroups@z-web.be>
    wrote:
    [color=blue]
    >in the following insert the strtolower wont put the chars in lowercase.
    >Any ideas what i'm doing wrong?
    >
    >the code:
    >
    >$qryInsRel = "INSERT INTO \"tblrelations\ " (rid, vcfirstname,
    >vclastname, vccompany, vcfunction, nlangid, ngenderid, nuserid,
    >ntitleid, dtbirthdate, vcbankaccount, vcvatnr, vctraderegister nr)
    >VALUES(" . $relNextVal .", '" . $_POST["txtFirstNa me"] . "', '" .
    >
    > strtolower($_PO ST["txtLastNam e"])
    >
    >. "', '" . $_POST["txtCompany "] . "', '" . $_POST["txtFunctio n"] . "',
    >'" . $_POST["txtLanguag e"] . "', '" . $_POST["txtGender"] . "', '" .
    >$_COOKIE["cUserID"] . "', '" . $_POST["txtTitle"] . "', '" . $bday .
    >"', '" . $_POST["txtBankaccount "] . "', '" . $_POST["txtVATNr"] . "',
    >'" . $_POST["txtTradeRe gNr"] . "')";
    >
    >(btw i moved a bit from the layout of the code but the rest is exactly
    >what i have)[/color]

    What evidence do you have that it is not converting to lower case?

    --
    Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
    Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

    Comment

    • Janwillem Borleffs

      #3
      Re: strtolower wont do his job


      "Kristof Goossens" <newsgroups@z-web.be> schreef in bericht
      news:bsa7tp$7vp $1@reader10.wxs .nl...[color=blue]
      > Hi you guys,
      >
      > in the following insert the strtolower wont put the chars in lowercase.
      > Any ideas what i'm doing wrong?
      >[/color]

      When using mysql (and many other databases), it doesn't make sence to
      lowercase data, because non-binary data is treated case-insensitive by
      default.


      JW



      Comment

      • Dark Angel

        #4
        Re: strtolower wont do his job

        but from what I've been reading about this can be changed in the db can it
        not?

        --
        Best Regards
        Dark Angel

        --------------------------------------------------------------------------
        http://www.stateofmind.me.uk - My Home Page
        http://www.keir.net/k9.html - Free spam filter for windows
        http://www.shrine2aeris.co.uk - My shrine to Aeris from FF7
        "Janwillem Borleffs" <jw@jwscripts.c om> wrote in message
        news:3fe8ba38$0 $127$3b62cedd@n ews.wanadoo.nl. ..[color=blue]
        >
        > "Kristof Goossens" <newsgroups@z-web.be> schreef in bericht
        > news:bsa7tp$7vp $1@reader10.wxs .nl...[color=green]
        > > Hi you guys,
        > >
        > > in the following insert the strtolower wont put the chars in lowercase.
        > > Any ideas what i'm doing wrong?
        > >[/color]
        >
        > When using mysql (and many other databases), it doesn't make sence to
        > lowercase data, because non-binary data is treated case-insensitive by
        > default.
        >
        >
        > JW
        >
        >
        >[/color]


        Comment

        • Janwillem Borleffs

          #5
          Re: strtolower wont do his job


          "Dark Angel" <nightshade220@ hotmail.com> schreef in bericht
          news:ns3Gb.316$ Y45.114@news-binary.blueyond er.co.uk...[color=blue]
          > but from what I've been reading about this can be changed in the db can it
          > not?
          >[/color]

          True, that's why I said `by default`.


          JW



          Comment

          • Andy Hassall

            #6
            Re: strtolower wont do his job

            On Tue, 23 Dec 2003 22:57:14 +0100, "Janwillem Borleffs" <jw@jwscripts.c om>
            wrote:
            [color=blue]
            >"Kristof Goossens" <newsgroups@z-web.be> schreef in bericht
            >news:bsa7tp$7v p$1@reader10.wx s.nl...[color=green]
            >>
            >> in the following insert the strtolower wont put the chars in lowercase.
            >> Any ideas what i'm doing wrong?[/color]
            >
            >When using mysql (and many other databases), it doesn't make sence to
            >lowercase data, because non-binary data is treated case-insensitive by
            >default.[/color]

            If you want your data stored in lowercase, that's a different matter from how
            the database does comparisons. Besides, no database was mentioned.

            --
            Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
            Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

            Comment

            • Dark Angel

              #7
              Re: strtolower wont do his job

              still learning u see, so it some times good to ask questions. :) keeps them
              brains cells alive :)

              --
              Best Regards
              Dark Angel

              --------------------------------------------------------------------------
              http://www.stateofmind.me.uk - My Home Page
              http://www.keir.net/k9.html - Free spam filter for windows
              http://www.shrine2aeris.co.uk - My shrine to Aeris from FF7
              "Janwillem Borleffs" <jw@jwscripts.c om> wrote in message
              news:3fe8c43f$0 $64988$1b62eedf @news.euronet.n l...[color=blue]
              >
              > "Dark Angel" <nightshade220@ hotmail.com> schreef in bericht
              > news:ns3Gb.316$ Y45.114@news-binary.blueyond er.co.uk...[color=green]
              > > but from what I've been reading about this can be changed in the db can[/color][/color]
              it[color=blue][color=green]
              > > not?
              > >[/color]
              >
              > True, that's why I said `by default`.
              >
              >
              > JW
              >
              >
              >[/color]


              Comment

              • Janwillem Borleffs

                #8
                Re: strtolower wont do his job


                "Andy Hassall" <andy@andyh.co. uk> schreef in bericht
                news:prhhuv0egd 8r5talcjurmh01k d16b535a0@4ax.c om...[color=blue]
                >
                > If you want your data stored in lowercase, that's a different matter from[/color]
                how[color=blue]
                > the database does comparisons.[/color]

                Sure, but it's my guess that the data is stored lowercase for an easy match
                in a where/like clause. When I'm wrong in my assumption, the OP will ignore
                my post.
                [color=blue]
                > Besides, no database was mentioned.
                >[/color]

                No, but an SQL query was. That's why I started with `When using mysql...`.
                When not applicable, the audience will ignore my comment automaitcally.


                JW



                Comment

                • Janwillem Borleffs

                  #9
                  Re: strtolower wont do his job


                  "Dark Angel" <nightshade220@ hotmail.com> schreef in bericht
                  news:024Gb.489$ Y45.8@news-binary.blueyond er.co.uk...[color=blue]
                  >
                  > still learning u see, so it some times good to ask questions. :) keeps[/color]
                  them[color=blue]
                  > brains cells alive :)
                  >[/color]

                  Your absolutely right :-)

                  Regards,
                  JW



                  Comment

                  • Kristof Goossens

                    #10
                    Re: strtolower wont do his job

                    Janwillem Borleffs wrote:
                    [color=blue]
                    > "Andy Hassall" <andy@andyh.co. uk> schreef in bericht
                    > news:prhhuv0egd 8r5talcjurmh01k d16b535a0@4ax.c om...
                    >[color=green]
                    >> If you want your data stored in lowercase, that's a different matter from[/color]
                    >
                    > how
                    >[color=green]
                    >>the database does comparisons.[/color]
                    >
                    >
                    > Sure, but it's my guess that the data is stored lowercase for an easy match
                    > in a where/like clause. When I'm wrong in my assumption, the OP will ignore
                    > my post.
                    >
                    >[color=green]
                    >>Besides, no database was mentioned.
                    >>[/color]
                    >
                    >
                    > No, but an SQL query was. That's why I started with `When using mysql...`.
                    > When not applicable, the audience will ignore my comment automaitcally.
                    >
                    >
                    > JW
                    >
                    >
                    >[/color]
                    Hi thx to all for the reply,

                    i'm using postgre-sql and i need the data in lowercase so i can order it
                    by surname. Now he orders the data ascending but first for the Uppercase
                    names and then for the lowercase names so you get something like this:

                    Aword
                    Bword
                    Zword
                    aword
                    bword
                    zword

                    and if i insert them in lowercase by default this problem should be fixed...

                    greetz,

                    kristof

                    Comment

                    • Geoff Berrow

                      #11
                      Re: strtolower wont do his job

                      I noticed that Message-ID: <bsbf04$gg0$1@r eader08.wxs.nl> from Kristof
                      Goossens contained the following:
                      [color=blue]
                      >Aword
                      >Bword
                      >Zword
                      >aword
                      >bword
                      >zword
                      >
                      >and if i insert them in lowercase by default this problem should be fixed...[/color]

                      But you'll have to correct the case again (ie change the first letter to
                      uppercase using something like substr()) before you can use it. May as
                      well do that before you store it.

                      --
                      Geoff Berrow (put thecat out to email)
                      It's only Usenet, no one dies.
                      My opinions, not the committee's, mine.
                      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                      Comment

                      • Markus Ernst

                        #12
                        Re: strtolower wont do his job

                        "Geoff Berrow" <blthecat@ckdog .co.uk> schrieb im Newsbeitrag
                        news:e8piuv4866 8q6hkobspb2b3st 5d6e5qhuq@4ax.c om...[color=blue]
                        > I noticed that Message-ID: <bsbf04$gg0$1@r eader08.wxs.nl> from Kristof
                        > Goossens contained the following:
                        >[color=green]
                        > >Aword
                        > >Bword
                        > >Zword
                        > >aword
                        > >bword
                        > >zword
                        > >
                        > >and if i insert them in lowercase by default this problem should be[/color][/color]
                        fixed...[color=blue]
                        >
                        > But you'll have to correct the case again (ie change the first letter to
                        > uppercase using something like substr()) before you can use it. May as
                        > well do that before you store it.[/color]

                        To convert the first character to uppercase you can use ucfirst().

                        Anyway I suggest to store the names unchanged, as some might begin with a
                        lowercase character (van Damme, ar Rashid...). Just convert the string for
                        the sort. In MySQL there is a UPPER() function to convert to uppercase:

                        .... ORDER BY UPPER(name)

                        (not tested). There might be something similar in Postgre SQL.

                        HTH
                        Markus


                        Comment

                        • Geoff Berrow

                          #13
                          Re: strtolower wont do his job

                          I noticed that Message-ID: <3fe97250$0$138 79$afc38c87@new s.easynet.ch>
                          from Markus Ernst contained the following:
                          [color=blue]
                          >To convert the first character to uppercase you can use ucfirst().[/color]

                          So many functions, so little memory...[color=blue]
                          >
                          >Anyway I suggest to store the names unchanged, as some might begin with a
                          >lowercase character (van Damme, ar Rashid...). Just convert the string for
                          >the sort. In MySQL there is a UPPER() function to convert to uppercase:[/color]

                          Yes you are right.

                          --
                          Geoff Berrow (put thecat out to email)
                          It's only Usenet, no one dies.
                          My opinions, not the committee's, mine.
                          Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                          Comment

                          • Kristof Goossens

                            #14
                            Re: strtolower wont do his job

                            Geoff Berrow wrote:
                            [color=blue]
                            > I noticed that Message-ID: <3fe97250$0$138 79$afc38c87@new s.easynet.ch>
                            > from Markus Ernst contained the following:
                            >
                            >[color=green]
                            >>To convert the first character to uppercase you can use ucfirst().[/color]
                            >
                            >
                            > So many functions, so little memory...
                            >[color=green]
                            >>Anyway I suggest to store the names unchanged, as some might begin with a
                            >>lowercase character (van Damme, ar Rashid...). Just convert the string for
                            >>the sort. In MySQL there is a UPPER() function to convert to uppercase:[/color]
                            >
                            >
                            > Yes you are right.
                            >[/color]
                            thx guys it worked

                            and a Merry X-mass to ya all :)

                            Comment

                            Working...