RE: [PHP] can someone explain this query to me
WHERE id IN (1,2,3) Is the same as saying WHERE id = 1 OR id = 2 OR id = 3 Few more details in this link http://www.w3schools.com/sql/sql_in.asp HTH Dan -Original Message- From: Ross [mailto:[EMAIL PROTECTED] Sent: 20 December 2005 12:07 To: php-general@lists.php.net Subject: [PHP] can someone explain this query to me $query = "delete from meetings where id IN (".implode(",", $ids).")"; Just the end bit, ids is an array of values (1,2,3,4,5) what does the IN do?? Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1328 (20051219) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can someone explain this query to me
Ross, Ross wrote: > $query = "delete from meetings where id IN (".implode(",", $ids).")"; > > Just the end bit, ids is an array of values (1,2,3,4,5) what does the IN > do?? It's the equivalent of WHERE id = 1 OR id = 2 OR id = 3 OR id = 4 OR id = 5. Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can someone explain this?
On 08 June 2004 19:00, René Fournier wrote: > OK, that makes sense. But here's the problem: I receive binary data > from SuperSPARC (big-endian), which I need to unpack according to > certain documented type definitions. For example, let's say that $msg > has the value "3961595508" and is packed as an unsigned long integer > (on the remote SPARC). But when I receive it, and unpack it... > > $unpacked = unpack('Nval', $msg); // N for unsigned long integer, > big-endian (SPARC) echo $unpacked["val"]; > > ...the output value is "-71788". (???) Which tells me that PHP is > NOT unpacking $msg as an unsigned long integer, but rather as > a signed > integer (since unsigned integers cannot be negative). > > Now, thanks to your suggestions, I can convert that number back to an > unsigned integer-or at least make it positive. But I > shouldn't have to > convert it, should I? Yes. Whether an integer is signed or unsigned is simply a matter of how you interpret the 32 bits representing it -- unsigned 3961595508 is represented in 32 bits in exactly the same way as signed -71788. This explains the results you are getting: PHP *is* unpacking your binary(?) data as unsigned, but, as PHP doesn't have an unsigned type, the only place it has to put the resulting 32-bit representation is in a PHP integer, which is signed -- so when you print it, you get the signed representation. To get PHP to print the unsigned representation of an integer, you can use the %u format specifier of sprintf() (http://www.php.net/sprintf) or one of its *printf friends. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this?
Thanks. The fact that this behaviour is a bug somehow makes me feel better. At least I'm not crazy—or, not as crazy as I thought. ...Rene On Tuesday, June 8, 2004, at 12:57 PM, Curt Zirzow wrote: * Thus wrote Ren Fournier ([EMAIL PROTECTED]): Now, thanks to your suggestions, I can convert that number back to an unsigned integer—or at least make it positive. But I shouldn't have to convert it, should I? Not necessarily, it mostly due to the limitation that php doesn't have unsigned integers. I have a patch for php that will return a unsigned integer as a string, but I havn't gotten it put into php yet. http://www.phpbuilder.com/lists/php-general/2003121/0526.php Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this?
* Thus wrote Ren Fournier ([EMAIL PROTECTED]): > > Now, thanks to your suggestions, I can convert that number back to an > unsigned integeror at least make it positive. But I shouldn't have to > convert it, should I? Not necessarily, it mostly due to the limitation that php doesn't have unsigned integers. I have a patch for php that will return a unsigned integer as a string, but I havn't gotten it put into php yet. http://www.phpbuilder.com/lists/php-general/2003121/0526.php Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this?
OK, that makes sense. But here's the problem: I receive binary data from SuperSPARC (big-endian), which I need to unpack according to certain documented type definitions. For example, let's say that $msg has the value "3961595508" and is packed as an unsigned long integer (on the remote SPARC). But when I receive it, and unpack it... $unpacked = unpack('Nval', $msg); // N for unsigned long integer, big-endian (SPARC) echo $unpacked["val"]; ...the output value is "-71788". (???) Which tells me that PHP is NOT unpacking $msg as an unsigned long integer, but rather as a signed integer (since unsigned integers cannot be negative). Now, thanks to your suggestions, I can convert that number back to an unsigned integer—or at least make it positive. But I shouldn't have to convert it, should I? ...Rene On Tuesday, June 8, 2004, at 11:29 AM, Curt Zirzow wrote: * Thus wrote Ren Fournier ([EMAIL PROTECTED]): -= PRODUCES: =- -71788 3961595508 Is this something about signed versus unsigned integers? What I really would like to do is convert that negative number (-71788), which I suppose is unsigned to a signed integer (3961595508) without having to convert it to hex, then back to decimal. You have it backwords.. -71788 is signed and the 3961595508 is unsigned. But... Do note that php doesn't have native unsigned numbers so doing something like this wont work right: printf("%d", $unsigned); // == 2147483647 So to convert it back you have to do something like: printf("%d", $unsigned+0); // == -71788 Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this?
> Forgive me if my math is askew, but doesn't the negative imply the > number is signed? If I remember from my C++ days, a declaration of: > > unsigned int blah; > > Meant you could not store negative numbers in that variable. Hence, > negatives would be signed. No? Yes, but once it become a hex string (after dechex()), all that info is gone. I think the way to handle this situation is to use pack & unpack. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this?
* Thus wrote Ren Fournier ([EMAIL PROTECTED]): > -= PRODUCES: =- > > -71788 > 3961595508 > > > Is this something about signed versus unsigned integers? What I really > would like to do is convert that negative number (-71788), which I > suppose is unsigned to a signed integer (3961595508) without having to > convert it to hex, then back to decimal. You have it backwords.. -71788 is signed and the 3961595508 is unsigned. But... http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this?
Forgive me if my math is askew, but doesn't the negative imply the number is signed? If I remember from my C++ days, a declaration of: unsigned int blah; Meant you could not store negative numbers in that variable. Hence, negatives would be signed. No? On Tue, 2004-06-08 at 12:52, René Fournier wrote: > $dec = -71788; > echo $dec."\n"; > > $hex = dechex($dec)."\n"; > $dec2 = hexdec($hex)."\n"; > > echo $dec2."\n"; > > -= PRODUCES: =- > > -71788 > 3961595508 > > > Is this something about signed versus unsigned integers? What I really > would like to do is convert that negative number (-71788), which I > suppose is unsigned to a signed integer (3961595508) without having to > convert it to hex, then back to decimal. > > Rene -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this? include problem.....?
On March 9, 2003 04:30 pm, Beauford.2002 wrote: > Sorry, the line I was actually referring to is the one below. I > forgot the hidden one was even there and serves no purpose and does > not resolve the problem by removing it. > > This works: > It also works if I just hardcode a value (value="Bob") > > This doesn't: > > They are both exactly the same other than the way they get their > values, so I don't see a reason why I'm losing part of the second > input line. Just to be clear, when I view the souce code I see > this: > > The value= has been > stripped from the code Look really hard at that second line.. Notice anything missing? I dont know why its stripped from your browser source but theres an obvious mistake. leo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this? include problem.....?
Sorry, the line I was actually referring to is the one below. I forgot the hidden one was even there and serves no purpose and does not resolve the problem by removing it. This works: It also works if I just hardcode a value (value="Bob") This doesn't: They are both exactly the same other than the way they get their values, so I don't see a reason why I'm losing part of the second input line. Just to be clear, when I view the souce code I see this: The value= has been stripped from the code Thanks - Original Message - From: "Chris Hayes" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 09, 2003 4:32 PM Subject: Re: [PHP] Can someone explain this? include problem.? > At 22:15 9-3-2003, you wrote: > >Hi, > > > >I have a php script which does some stuff and at the end of the file I have > >it include a file which has a form in it. The problem I am having is that it > >is missing code. If you go down to the second input - it has a value="0" > >field - this does not show up when I view the source from my browser. The > >first input value= works fine. > have a closer look at it!! > > compare your first line: > > > to the failing line: > > > > I'm sure you can see it :) > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this? include problem.....?
At 22:15 9-3-2003, you wrote: Hi, I have a php script which does some stuff and at the end of the file I have it include a file which has a form in it. The problem I am having is that it is missing code. If you go down to the second input - it has a value="0" field - this does not show up when I view the source from my browser. The first input value= works fine. have a closer look at it!! compare your first line: to the failing line: I'm sure you can see it :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this????
Dallas K. wrote: > try this when u get a sec. You want to see something really weird? Try using 'MORON' instead of 'NYC'. It doesn't actually mean anything, but at least you'll have a signature you can start using if you're going to keep posting this tripe... My $0.02. -- ___ ____ _ Chris Hobbs / \ \/ / | | |/ ___\| __ \ Head Geek| (___ \ \ / /| | | | (___ | | | | WebMaster \___ \ \ \/ / | | | |\___ \| | | | PostMaster) | \ / | |__| |) | |__| | \/\/\/ \/|_/ http://www.silvervalley.k12.ca.us [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]