Constant for maximum integer value?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado@zipmail.com

    Constant for maximum integer value?

    Hi,

    I'm using PHP 5 with MySql 5. I have a MySQL InnoDB table with a
    column of type INTEGER UNSIGNED. Is there a constant in PHP to insert
    the maximum value possible into the column? The underlying OS is Red
    Hat Linux, but I'm not sure about the version.

    Any help you can provide is appreciated, - Dave
  • Jerry Stuckle

    #2
    Re: Constant for maximum integer value?

    laredotornado@z ipmail.com wrote:
    Hi,
    >
    I'm using PHP 5 with MySql 5. I have a MySQL InnoDB table with a
    column of type INTEGER UNSIGNED. Is there a constant in PHP to insert
    the maximum value possible into the column? The underlying OS is Red
    Hat Linux, but I'm not sure about the version.
    >
    Any help you can provide is appreciated, - Dave
    The maximum in PHP does not necessarily equate to the maximum in MySQL.

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

    Comment

    • laredotornado@zipmail.com

      #3
      Re: Constant for maximum integer value?

      On Nov 15, 4:32 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      laredotorn...@z ipmail.com wrote:
      Hi,
      >
      I'm using PHP 5 with MySql 5.  I have a MySQL InnoDB table with a
      column of type INTEGER UNSIGNED.  Is there a constant in PHP to insert
      the maximum value possible into the column?  The underlying OS is Red
      Hat Linux, but I'm not sure about the version.
      >
      Any help you can provide is appreciated, - Dave
      >
      The maximum in PHP does not necessarily equate to the maximum in MySQL.
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===
      When I said "to insert the maximum value in the column", I meant the
      maximum value that MySQL will allow. Is there a PHP expression that
      can evaluate to the maximum unsigned integer in MySQL or do I just
      need to hard code the maximum number in my code? - Dave

      Comment

      • Jerry Stuckle

        #4
        Re: Constant for maximum integer value?

        laredotornado@z ipmail.com wrote:
        On Nov 15, 4:32 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >laredotorn...@ zipmail.com wrote:
        >>Hi,
        >>I'm using PHP 5 with MySql 5. I have a MySQL InnoDB table with a
        >>column of type INTEGER UNSIGNED. Is there a constant in PHP to insert
        >>the maximum value possible into the column? The underlying OS is Red
        >>Hat Linux, but I'm not sure about the version.
        >>Any help you can provide is appreciated, - Dave
        >The maximum in PHP does not necessarily equate to the maximum in MySQL.
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        When I said "to insert the maximum value in the column", I meant the
        maximum value that MySQL will allow. Is there a PHP expression that
        can evaluate to the maximum unsigned integer in MySQL or do I just
        need to hard code the maximum number in my code? - Dave
        What you need then is the maximum MySQL value, not the maximum PHP
        value. They are two different things.

        Try comp.databases. mysql.

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

        Comment

        • Erwin Moller

          #5
          Re: Constant for maximum integer value?

          nadia schreef:
          On Sat, 15 Nov 2008 14:11:33 -0800 (PST), "laredotornado@ zipmail.com"
          <laredotornado@ zipmail.comwrot e:
          >
          >Hi,
          >>
          >I'm using PHP 5 with MySql 5. I have a MySQL InnoDB table with a
          >column of type INTEGER UNSIGNED. Is there a constant in PHP to insert
          >the maximum value possible into the column? The underlying OS is Red
          >Hat Linux, but I'm not sure about the version.
          >>
          >Any help you can provide is appreciated, - Dave
          >
          Dave - PHP (very annoyingly) only provides a signed 32 bit integer.
          That means that's the highest integer you can use.
          My guess is your database has an unsigned 32 bit integer type leaving
          you dangling in the wind if you don't know about this. We had a similar problem
          we had to work around using sprintf() - that only works up to a certain value
          also. (Our problem was related to file sizes which for video's is a serious
          drawback to using PHP)
          >
          nadia
          >
          Nadia, just curious: Are you claiming you didn't have enough room in a
          32 bit integer to store the file size of a video?
          If not, what did go wrong?

          Anyway, if you need Big Numbers and want to be excact, try BC Math
          Functions:


          Regards,
          Erwin Moller


          --
          "There are two ways of constructing a software design: One way is to
          make it so simple that there are obviously no deficiencies, and the
          other way is to make it so complicated that there are no obvious
          deficiencies. The first method is far more difficult."
          -- C.A.R. Hoare

          Comment

          • =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?=

            #6
            Re: Constant for maximum integer value?

            Erwin Moller escribió:
            Nadia, just curious: Are you claiming you didn't have enough room in a
            32 bit integer to store the file size of a video?
            Let me answer. Believe it or not, that's true. But that's not all. There
            doesn't seem to be any simple way to get the size of file that's larger
            than 4GB (i.e., 2^32 bytes). Function filesize() won't return the right
            size.



            --
            -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
            -- Mi sitio sobre programación web: http://bits.demogracia.com
            -- Mi web de humor al baño María: http://www.demogracia.com
            --

            Comment

            • Erwin Moller

              #7
              Re: Constant for maximum integer value?

              nadia schreef:
              On Mon, 17 Nov 2008 16:09:13 +0100, "Álvaro G. Vicario"
              <alvaroNOSPAMTH ANKS@demogracia .comwrote:
              >
              >Erwin Moller escribió:
              >>Nadia, just curious: Are you claiming you didn't have enough room in a
              >>32 bit integer to store the file size of a video?
              >Let me answer. Believe it or not, that's true. But that's not all. There
              >doesn't seem to be any simple way to get the size of file that's larger
              >than 4GB (i.e., 2^32 bytes). Function filesize() won't return the right
              >size.
              >
              >
              Thank you Alvaro - thats the point I was making exactly.
              >
              Nadia
              >
              Hi,

              Hmm, I never worked with such huge files, but I imagine that must be
              really annoying.
              How do you solve that problem?
              Do you resort to *nix commands (and pass them to exec() and the like) to
              get the info you want?

              Regards,
              Erwin Moller


              --
              "There are two ways of constructing a software design: One way is to
              make it so simple that there are obviously no deficiencies, and the
              other way is to make it so complicated that there are no obvious
              deficiencies. The first method is far more difficult."
              -- C.A.R. Hoare

              Comment

              • Erwin Moller

                #8
                Re: Constant for maximum integer value?

                nadia schreef:
                >Nadia, just curious: Are you claiming you didn't have enough room in a
                >32 bit integer to store the file size of a video?
                >If not, what did go wrong?
                >>
                >Anyway, if you need Big Numbers and want to be excact, try BC Math
                >Functions:
                >http://nl3.php.net/manual/en/ref.bc.php
                >>
                >
                Erwin - see my response to Alvaro.
                >
                In the end we changed the applicaion to borland delphi and did it that way.
                We came across a couple of hidden issues with PHP we just couldn't work
                around.
                >
                As someone said here some time ago - PHP is a fantastic script language
                but for anything serious you really should go to a full blown compiled language.
                At least our experience has led us to believe this also.
                Hi,

                I don't want to be picky, but I believe I only build serious webapps in
                PHP.
                I don't think you can say in general that if you need to build anything
                serious you cannot use PHP.

                Allthough I feel your pain when you cannot get the filesize when a file
                4GB. That really is a problem I wasn't aware of.
                Can you give me more problems you encountered with PHP that made you
                'fallback' to Delphi? (No pun intended to Delphi at all)
                I am curious since it is better to know this kind of things before I
                screw up some project. ;-)

                Regards,
                Erwin Moller

                >
                nadia.
                >

                --
                "There are two ways of constructing a software design: One way is to
                make it so simple that there are obviously no deficiencies, and the
                other way is to make it so complicated that there are no obvious
                deficiencies. The first method is far more difficult."
                -- C.A.R. Hoare

                Comment

                Working...