[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
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 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?
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
[PHP] Can someone explain this?
$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 -- 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? 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?
* 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... ?php $dec = -71788; $unsigned = sprintf(%ul, $dec); print $unsigned; // == 3961595508 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
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?
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 integeror 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... ?php $dec = -71788; $unsigned = sprintf(%ul, $dec); print $unsigned; // == 3961595508 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?
* 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?
Thanks. The fact that this behaviour is a bug somehow makes me feel better. At least I'm not crazyor, 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 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can someone explain...
this difference bewteen A and B below? A)$a = new className(true, 6); B)$a = new className(true, 6); /* missing on the NEW */ thanks walter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can someone explain this? include problem.....?
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. Anyone have any ideas on this.TIA i.e. ? php stuff; include(theform.inc); ? This is theform.inc.. FORM ACTION=stats-write.php action=post name=update INPUT TYPE=hidden name=FromPosted value=TRUE TABLE ALIGN=center WIDTH=200 TRTD COLSPAN=2HR SIZE=3 COLOR=#63687B/TR/TD /TD/TR TRTD ID=WD CLASS=mainPlayer:/TD TD ALIGN=right ID=WD input type=text name=player SIZE=10 value=? echo $line['player']; ? /TD/TR TRTD COLSPAN=2HR SIZE=3 COLOR=#63687B/TR/TD TRTD ID=WD CLASS=mainGoals:/TD TD ALIGN=right ID=WD input type=text name=goals SIZE=5 value0 /TD/TR TR HEIGHT=5TD ID=WD/TD TRTD COLSPAN=2HR SIZE=3 COLOR=#63687B/TD/TR TD ALIGN=center colspan=2 input type=submit value=Update name=submit /TD/TR/TABLE /FORM -- 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: INPUT TYPE=hidden name=FromPosted value=TRUE to the failing line: input type=text name=goals SIZE=5 value0 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? 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: input type=text name=player SIZE=10 value=? echo $line['player']; ? It also works if I just hardcode a value (value=Bob) This doesn't: input type=text name=goals SIZE=5 value0 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: input type=text name=goals SIZE=5 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: INPUT TYPE=hidden name=FromPosted value=TRUE to the failing line: input type=text name=goals SIZE=5 value0 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.....?
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: input type=text name=player SIZE=10 value=? echo $line['player']; ? It also works if I just hardcode a value (value=Bob) This doesn't: input type=text name=goals SIZE=5 value0 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: input type=text name=goals SIZE=5 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
[PHP] Can someone explain this please...
Hello! I am doing this $newpath = ./uploads/newdir/; if (!is_dir($newpath)) mkdir($newpath, 0666); $decperms = fileperms($newpath); $octalperms = sprintf(%o,$decperms); $perms=(substr($octalperms,2)); echo $perms; if ($perms != 777) { rmdir ($newpath); } This will not delete the dir created with $newpath. It will only work if i change this if ($perms != 777) into this if ($perms != '777' ) // Please note the single quotes around 777 Could someone tell me why it behaves like this? Cause if for example i do this $foo = 1; if ($foo == 1) //will evaluate as true, so why not with the above? Thanks a lot in advance for your time and help! Best regards from Vienna, Jürgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can someone explain this????
try this when u get a sec. its weird... In Microsoft Word, start with a blank page and type the letters NYC in all caps. Highlight the letters and change to the largest font size, 72 points. Now change the font itself to Webdings . that's not all. Now change the font again, to Wingdings. (use the first version of Wingdings) If you ask me that's just weird.
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]