473,699 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 15 '08 #1
7 6997
la***********@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.
js*******@attgl obal.net
=============== ===
Nov 15 '08 #2
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
Nov 15 '08 #3
la***********@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.
js*******@attgl obal.net
=============== ===
Nov 15 '08 #4
nadia schreef:
On Sat, 15 Nov 2008 14:11:33 -0800 (PST), "la***********@ zipmail.com"
<la***********@ 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:
http://nl3.php.net/manual/en/ref.bc.php

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
Nov 17 '08 #5
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
--
Nov 17 '08 #6
nadia schreef:
On Mon, 17 Nov 2008 16:09:13 +0100, "Álvaro G. Vicario"
<al************ ****@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
Nov 17 '08 #7
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
Nov 17 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2328
by: Hennie de Nooijer | last post by:
Because of an error in google or underlying site i can reply on my own issue. Therefore i copied the former entered message in this message. -------------------------------------REPY---------------------------------- Hi Maybe i wasn't clear. I want to dynamically check whether what the lowest date and the highest date is in the calendar table. The presented solutions has fixed dates and i don't want that. If i could store a global...
6
4903
by: cipher | last post by:
I have some constant values in my web service that my client application will require. Having to keep server side and client side definitions insync is tedious. I am trying to do something like this: public __value enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 }; However, the resulting wsdl omits the actual flag values: - <s:simpleType name="Colors">
3
36893
by: yawnmoth | last post by:
I'm trying to figure out how big integers in PHP can be and am having some difficulty. My first idea was to try something like this: <? for ($bits=0; (1<<($bits+1)) > (1<<$bits); $bits++); echo $bits; ?>
6
35668
by: fctk | last post by:
hello, i'm trying to compile this small program: int main(void) { unsigned long int max; max = 4000000000;
29
5100
by: garyusenet | last post by:
I'm trying to investigate the maximum size of different variable types. I'm using INT as my starting variable for exploration. I know that the maximum number that the int variable can take is: 65,535. But i'm trying to write a program to test this, assuming I didn't know this number in advance. I came up with the following but have two questions. Maybe someone can help? using System; using System.Collections.Generic; using System.Text;
2
3386
by: Pugi! | last post by:
hi, I am using this code for checking wether a value (form input) is an integer and wether it is smaller than a given maximum and greater then a given minimum value: function checkInteger(&$value, $checks) { $err = ''; if (!is_numeric($value) || (floatval($value) != intval($value))) { $err .= 'Input must be an integer. ';
4
4187
by: Felix Kater | last post by:
Hi, when I use something like int Shift= 3; long Value= 1 << Shift; What is the data type of the const value '1' here? In other terms: What is the possible maximum of 'Shift' here?
33
5550
by: desktop | last post by:
In the C++ standard sec 23.1.2 table 69 it says that erase(q) where q is a pointer to an element can be done in amortized constant time. I guess that is not worst case since std::set is practically a red-black tree where insert/delete takes O(lg n) time. Or are there some other explanation for this complexity?
26
3695
by: kerravon | last post by:
The following C program: int main(void) { int x = -2147483648; return (0); } Produces the following warning:
0
8704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9192
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8939
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8895
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7778
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3071
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.