[PHP] Re: NULL Date Entries...
Don Wieland wrote: In one of my forms, I am building a variable that I can use as an INSERT string. On my form, I have several DATE fields which exist of 3 fields MM - DD - when I build my string it looks like this: array('dbf'='applicant_dob', 'f'=array('applicant_dob_1','applicant_dob_2','applicant_dob_3'), 'req'=0, 's'='/'), This enters in the DB fine when there is a DATE, but when these fields are left empty, it inserts into the the DB as 2069-12-31. How does one deal with this? Don Wieland Aside from all the good advice already offered, if you want to accept a null date, check what your DB does with it and whether you can set a default for an empty date. Mysql for example can use -00-00 Cheers -- David Robley Microsoft - We put the backwards into backwards compatibility. Today is Pungenday, the 37th day of Confusion in the YOLD 3176. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing NULL behavior in PHP arithmetic
On Thu, 2010-04-15 at 09:46 +0200, cr.vege...@gmail.com wrote: Hi All, Is there an option in PHP to change the behavior of NULL in PHP functions ? Now PHP uses NULL as a 0 (zero) for arithmetic, for example: NULL + 6 = 6 NULL * 6 = 0 NULL / 6 = 0 6 / NULL = Division by zero What I need is the same behavior as #N/A (or =NA()) in Excel, where: #N/A + 6 = #N/A #N/A * 6 = #N/A #N/A / 6 = #N/A 6 / #N/A = #N/A because arithmetic operations with Unknown operands should result to Unknown ... TIA, Cor You can't really, because PHP is a loosely typed language, which means it silently converts values as required by the situation. When you use mathematical operators, PHP converts the values to numbers, and NULL maps to a 0 (as does the boolean false and an empty string) The only way I can see to fix your problem is to check the value of the variables you are working on with something like is_int() Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] changing NULL behavior in PHP arithmetic
because arithmetic operations with Unknown operands should result to Unknown ... in PHP Unknown values are represented by NaN, not NULL http://php.net/manual/en/function.is-nan.php but what surprises me is is_nan(6/0) = (bool)false (along with a warning) Now PHP uses NULL as a 0 (zero) for arithmetic I dont expect anything different, because intval(null) is 0. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing NULL behavior in PHP arithmetic
From: Ashley Sheridan To: cr.vege...@gmail.com Cc: php-general@lists.php.net Sent: Thursday, April 15, 2010 10:08 AM Subject: Re: [PHP] changing NULL behavior in PHP arithmetic On Thu, 2010-04-15 at 09:46 +0200, cr.vege...@gmail.com wrote: Hi All, Is there an option in PHP to change the behavior of NULL in PHP functions ? Now PHP uses NULL as a 0 (zero) for arithmetic, for example: NULL + 6 = 6 NULL * 6 = 0 NULL / 6 = 0 6 / NULL = Division by zero What I need is the same behavior as #N/A (or =NA()) in Excel, where: #N/A + 6 = #N/A #N/A * 6 = #N/A #N/A / 6 = #N/A 6 / #N/A = #N/A because arithmetic operations with Unknown operands should result to Unknown ... TIA, Cor You can't really, because PHP is a loosely typed language, which means it silently converts values as required by the situation. When you use mathematical operators, PHP converts the values to numbers, and NULL maps to a 0 (as does the boolean false and an empty string) The only way I can see to fix your problem is to check the value of the variables you are working on with something like is_int() Thanks, Ash http://www.ashleysheridan.co.uk Thanks for replying. I tried the predefined PHP constant NAN. However, NAN + 6 = 6, so NAN is can't be used either. To bypass the problem, I now use is_null(). is_int() can also be used, but does it have advantages over is_null() ? Thanks, Cor
[PHP] Not Null?
Greetings, I have a script that looks for the variable to be NULL and then execute. Is there a way for the script to look for anything or something in the variable and then execute? Ex: If ($a¹ == ANYTHING¹) { some action }else{ some other action } Thank you for any help. -- Steve M.
Re: [PHP] Not Null?
On 31/10/2007, Steve Marquez [EMAIL PROTECTED] wrote: Greetings, I have a script that looks for the variable to be NULL and then execute. Is there a way for the script to look for anything or something in the variable and then execute? Ex: If (Œ$a¹ == Œ ANYTHING¹) { oh dear, krazee quotes... at least I presume that's what those wierd characters are. Look in the manual for isset() (http://www.php.net/isset) and empty() (http://www.php.net/empty). -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Not Null?
On 10/31/07, Robin Vickery [EMAIL PROTECTED] wrote: On 31/10/2007, Steve Marquez [EMAIL PROTECTED] wrote: Greetings, I have a script that looks for the variable to be NULL and then execute. Is there a way for the script to look for anything or something in the variable and then execute? Ex: If (Œ$a¹ == Œ ANYTHING¹) { oh dear, krazee quotes... at least I presume that's what those wierd characters are. Look in the manual for isset() (http://www.php.net/isset) and empty() (http://www.php.net/empty). -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Robin, I think you hit it exactly on the head with the quote issue. Steve, use regular single or double quotes, not any kind of fancy quotes or backticks. It may be the editor you're using: if you use Microsoft Word or another similar word processor, it may replace the quotes with something it things is prettier. If you're using Windows, use notepad, `edit.com` from the command line, or download any IDE you'd like - many or which are free and open source, and even handle PHP specifically. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergic and is hospitalized. See? No good deed goes unpunished -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Not Null?
2007. 10. 31, szerda keltezéssel 10.48-kor Steve Marquez ezt írta: Greetings, I have a script that looks for the variable to be NULL and then execute. Is there a way for the script to look for anything or something in the variable and then execute? Ex: If (Œ$a¹ == Œ ANYTHING¹) { some action }else{ some other action } try isset($a) greets Zoltán Németh Thank you for any help. -- Steve M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rtrim Null characters
So, for fun, (well, *MY* idea of fun) I implemented a dirt-simple CAPTCHA. The image is totally OCR-able, but anybody wants to work that hard at it can have at it. That's modular enough to (really) fix later anyway/ After lots of encryption/decryption with urlencoding, htmlentities, and base64_encoding, to keep all the data kosher over HTTP et al... I end up with a string with a bunch of NUL characters (ord($char) == 0) tacked on the end, but otherwise correctly decoded. I'm not really sure if it's base64 or the encryption itself that pads the string, and don't really care, to tell you the truth... Anyway, my question is, what is the morally correct function to use to remove these null characters from the end of my string? I'm guessing 'rtrim' would work, but is a NUL char really whitespace? I suppose I could do str_replace(), but if things go bad some day, I don't want to confuse myself by removing NUL characters in the middle of the messed up string. A second related question: Given that the string to be encrypted is a single word and thus very short, the PHP manual makes it quite clear that encrypt_mode of ECB is the right choice. YAY! What is not readily apparent, and what I can't figure out from my research is if any of the algorithms available is better suited to this usage. To be clear: I'm mcrypt_encrypt()ing the secret word into the URL and a hidden form element, along with the IV, ditto, and so both are available to the potentical malicious user. So if exposure of IV is an issue in any suggested answer, keep that in mind. The following options are available in my webhost's install: cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes We can safely eliminate any hypothetical best which is not in that list. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rtrim Null characters
On Fri, 2005-10-21 at 20:45 -0500, Richard Lynch wrote: Anyway, my question is, what is the morally correct function to use to remove these null characters from the end of my string? I'm guessing 'rtrim' would work, but is a NUL char really whitespace? I think rtrim() is probably your best bet. Haven't tried, though. To be clear: I'm mcrypt_encrypt()ing the secret word into the URL and a hidden form element, along with the IV, ditto, and so both are available to the potentical malicious user. So if exposure of IV is an issue in any suggested answer, keep that in mind. To be honest, I think you're going about it the wrong way. Put the secret word into $_SESSION. Point the img tag at a PHP script which pulls it out of $_SESSION and renders it as an image. Then you don't need to send it to the client in any form. -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Inserting NULL Integer Values
Hi, Up to this point in time I used to construct my insert statements like this $qid = mysql_query('INSERT INTO MYTABLE ( column1, column2, ) VALUES ( '.$value1.', '.$value2.' )'); However I understand it is better to remove the quote marks around an insert if the column type is an integer. This is easy to do, however if the $value is empty it causes a mysql error. Has anyone encountered this and found a solution? Thanks for your advice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting NULL Integer Values
$value2 = strlen($value2) ? $value2 : 'NULL'; On Tue, October 18, 2005 11:15 am, Shaun wrote: Hi, Up to this point in time I used to construct my insert statements like this $qid = mysql_query('INSERT INTO MYTABLE ( column1, column2, ) VALUES ( '.$value1.', '.$value2.' )'); However I understand it is better to remove the quote marks around an insert if the column type is an integer. This is easy to do, however if the $value is empty it causes a mysql error. Has anyone encountered this and found a solution? Thanks for your advice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] obscure error message - PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0
On Wed, March 16, 2005 2:32 pm, Zinovi Boyadjiev said: I am getting this strange error while developing imap mail to mysql inporting script : PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0 This looks like a custom error message and/or something coming about as a result of using http://php.net/eval -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] obscure error message - PHP Notice: (null)():
Richard Lynch wrote: On Wed, March 16, 2005 2:32 pm, Zinovi Boyadjiev said: I am getting this strange error while developing imap mail to mysql inporting script : PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0 This looks like a custom error message and/or something coming about as a result of using http://php.net/eval actually, last time I saw something like this was when I prepended a (php) file via the auto_append_file setting, and that file /included/ or opened another file that it didn't have access to. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] obscure error message - PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0
Hello, I am getting this strange error while developing imap mail to mysql inporting script : PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0 I am getting it at the end of the script execution without affecting any actual script functionality. I am using PHP 4.3.10 CLI interface on Windows Does someone experienced the same problem ? Do you have any solution or hint where to look for ? Regards, Zinovi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] find null character in php
Hello, I am having one string variable which has the value fetched from the mysql table. Is it possible to find '\0' character in that string ? Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] find null character in php
* Thus wrote T UmaShankari: Hello, I am having one string variable which has the value fetched from the mysql table. Is it possible to find '\0' character in that string ? http://php.net/strstr http://php.net/strpos strstr($nulledstring, \0); strpos($nulledstring, \0); Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Assign null value using php
Hello, Can any one tell me how to assign a null value to a php string?. I tried assigning empty single quote,backslash with zero,double quotes also. but nothing works.. Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assign null value using php
On Thursday 02 September 2004 20:23, T UmaShankari wrote: Can any one tell me how to assign a null value to a php string?. I tried assigning empty single quote,backslash with zero,double quotes also. but nothing works.. manual Types NULL -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* If only one solution can be found for a field problem, then it is usually a stupid solution -- Murphy's Military Laws n37 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assign null value using php
T UmaShankari wrote: Hello, Can any one tell me how to assign a null value to a php string?. I tried assigning empty single quote,backslash with zero,double quotes also. but nothing works.. Regards, Uma Use the manual, Luke. http://us4.php.net/manual/en/language.types.null.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 0 == null ?
Hi, Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? Any help or explanation would be greatly appreciated. Regards, Justin Palmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 0 == null ?
On Mon, 2004-05-10 at 15:17, Justin Palmer wrote: Hi, Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? Any help or explanation would be greatly appreciated. In C the NULL macro is equal to 0. In PHP null is equivalent to 0. The test will fail if you use === instead. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 0 == null ?
Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? You can use is_null instead. If(is_null($var)){ do something } Else{ do something different } alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
RE: [PHP] 0 == null ?
Hi Robert, Thanks. Regards, Justin Palmer -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Monday, May 10, 2004 12:22 PM To: [EMAIL PROTECTED] Cc: PHP-General Subject: Re: [PHP] 0 == null ? On Mon, 2004-05-10 at 15:17, Justin Palmer wrote: Hi, Does 0(zero) really equate to null? if( 0 == null ) { echo 'true'; } else echo 'false'; Result echo's: true This can not be right, can it? I have never heard of such a thing. As far as I recall from any language null is of no value equaling nothing? So how can it equal 0? Any help or explanation would be greatly appreciated. In C the NULL macro is equal to 0. In PHP null is equivalent to 0. The test will fail if you use === instead. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | a | powerful, scalable system for accessing system services | such as | forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] [Fwd: Re: [PHP-DEV] null / unset / isset ?]
reposted on this list as requested, an initial reply is include: Original Message Delivered-To: [EMAIL PROTECTED] To make matters worse, $x[5] = NULL; causes array_key_exists to return true for 5 even though isset($x[5]) is false and even worse, unset is the function you use to remove 5/NULL from the array. So... you have to unset something for which isset is false! I have to believe if they were starting from scratch today they wouldn't make such a mess, but too many people have code that relies on this unfortunate behavior for them to change it now. :( - Todd On Thu, 2004-04-08 at 11:05, Jochem Maas wrote: consider this if you will: ? echo ___THEEND EXPECT: isset(): true; is_null(): true; REALITY: ___THEEND; $varIsSet = null; var_dump( isset($varIsSet) ); var_dump( is_null($varIsSet) ); ? I would have thought that having set the variable to something even if its 'nothing' would mean it is set in the current variable scope. either that or it makes unset() redundant, no? and the PHP documentation leaves me with the impression that is_null() works with 'set' variables (and would give an E_NOTICE if an unset variable is set) is there a difference between null and unset()ing? does a variable that is null take up no memory (rather like variable that have never been defined or removed completely) apologies if this is misplaced. rgds, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] assigning NULL to a variable
William Lovaton wrote: El mar, 06-04-2004 a las 07:41, Marek Kilimajer escribió: Andy B wrote: how would you assign NULL to a variable if its original value is ? otherwise leave it with its value... if($var === '') $var = NULL; what about: if ($var == '') unset($var); No - NULL is not the same as unset() and the condition would evaluate to true even if $var === 0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] assigning NULL to a variable
Marek Kilimajer wrote: William Lovaton wrote: El mar, 06-04-2004 a las 07:41, Marek Kilimajer escribió: Andy B wrote: how would you assign NULL to a variable if its original value is ? otherwise leave it with its value... if($var === '') $var = NULL; what about: if ($var == '') unset($var); No - NULL is not the same as unset() and the condition would evaluate to true even if $var === 0 And if $var = false or null or '0' -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] assigning NULL to a variable
Andy B wrote: how would you assign NULL to a variable if its original value is ? otherwise leave it with its value... if($var === '') $var = NULL; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] assigning NULL to a variable
El mar, 06-04-2004 a las 07:41, Marek Kilimajer escribió: Andy B wrote: how would you assign NULL to a variable if its original value is ? otherwise leave it with its value... if($var === '') $var = NULL; what about: if ($var == '') unset($var); -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] assigning NULL to a variable
how would you assign NULL to a variable if its original value is ? otherwise leave it with its value... the form im working on has a date field called date on the form itself. that date will get turned into $_SESSION[add][date] on the next page... i want it so if the person filling out the form didnt leave a date (left date field blank) then it should be NULL so the mysql table will insert the current date... so far i have this code: if(empty($_SESSION['add']['date'])){ $_SESSION['add']['date']=NULL//or should it = FALSE?? } //if its already filled do nothing else to it is there a better way to do this than this way?
Re: [PHP] Re: Null Variables after session_register() ( Radio Inputs Problem )
Gohaku wrote: Thanks. Below is what I changed to session.php. Are there any possible problems with my changes? On Mar 23, 2004, at 4:28 PM, Justin Patrin wrote: ? /***Session.php**/ $varcount = 0; if($name){$varcount++;} if($number){$varcount++;} session_start(); session_register(name); session_register(number); ? ? /***Session.php**/ $varcount = 0; if($name){$varcount++;} if($number){$varcount++;} $_SESSION[name] = $name; $_SESSION[number] = $number; ? You may also want to start using $_POST, $_GET, or $_REQUEST as they're generally more secure than using globals. For instance, change it to this: ? /***Session.php**/ $varcount = 0; if($_POST['name']){$varcount++;} if($_POST['number']){$varcount++;} $_SESSION['name'] = $name; $_SESSION['number'] = $number; ? -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Null Variables after session_register() ( Radio Inputs Problem )
Gohaku wrote: Apologies if this has been asked before, I'm experiencing problems with Session Variables and Radio Inputs values. For some reason, after I use session_register(number) where $number has 3 possible values { 1,2,3 }, $number IS NULL. If I don't use session_register(number), $number IS NOT NULL. I did not see any difference with checkbox inputs either. Any help would be greatly appreciated. Thank you. -gohaku !--Form.html-- form action=session.php method=POST Name: input type=text name=name size=30br input type=radio name=number value=1 CHECKED1br input type=radio name=number value=22br input type=radio name=number value=33br input type=submit name=submit value=Session Test /form ? /***Session.php**/ $varcount = 0; if($name){$varcount++;} if($number){$varcount++;} session_start(); session_register(name); session_register(number); ? html headtitle?=$number?/title/head You may want to look into using the superglobal $_SESSION instead of using session_register and global variables. It's far more secure and generally works without so many problems. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Null Variables after session_register() ( Radio Inputs Problem )
Thanks. Below is what I changed to session.php. Are there any possible problems with my changes? On Mar 23, 2004, at 4:28 PM, Justin Patrin wrote: ? /***Session.php**/ $varcount = 0; if($name){$varcount++;} if($number){$varcount++;} session_start(); session_register(name); session_register(number); ? ? /***Session.php**/ $varcount = 0; if($name){$varcount++;} if($number){$varcount++;} $_SESSION[name] = $name; $_SESSION[number] = $number; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: null values
? function countNulls($array) { if (!is_array($array)) { return(NULL); } reset($array); $count=0; while(list(,$val)=each($array)) { if ($val===NULL) { $count++; } } return($count); } ? Aris Santillan wrote: hi how to count null values in an array? tnx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ldap_add() - null values in fields produce an value #0 invalid per syntax error on ldap server
Hi, New to the list and hoping someone might be able to help me. I have been using PHP scripts that are to maintain a company address book with a lot of data about contacts, both inside and outside the company. The scripts, which are generating html pages and reading input values back in, have been working fine with PHP 4.2.1 as a library module for apache 1.3.26 and openldap 1.2.13. However, openldap 2.0.23 and 25 have been generating errors with these same PHP scripts, specifically in the ldap_add() and ldap_modify() functions. The problem comes when fields in the html pages are left empty, which is normal for this application. For those familiar with the ldap_add/modify functions in PHP, the array that is passed in has some values, say for example title, fax, mobile, ... left empty, and therefore NULL (I have checked, they really are NULL's stored in the array). When the values make it to the ldap server however, they appear to be no longer NULL's, but a #0, and through debugging output on the ldap server, I have seen it is generating an invalid per syntax error. The ldap servers have been complied from source and installed on a SuSE linux professional 7.3 system. Hardware resources are no problem (640Mb RAM, 2Gb swap, 800Mhz processor, 130Gb HDD space with 6Gb free on the working partition with this stuff) Does anyone have any suggestions as to how I can address this problem. It is important that null values can make it into the ldap server as putting in other values to try to work around the problem will mess up other applications that use the ldap server, as will not inserting the fields into the ldap server. Ian The following code segment demonstrates the problem: ?php $ds=ldap_connect(localhost); // The LDAP server is on this host if ($ds) { // bind with appropriate dn to give update access $r=ldap_bind($ds,cn=ShnetAdmin, o=shnetdemo, thepassword); // prepare data $info[cn]=John Jones; $info[sn]=Jones; $info[mail]=; // - NULL VALUE HERE // The following lines also produce the same result... //$info[mail]=NULL; // --- NULL value here //$info[mail]=\0; // --- NULL value here //$info[mail]; // --- NULL value here $info[objectclass]=person; // add data to directory $r=ldap_add($ds, cn=ShnetAdmin, o=shnetdemo, $info); ldap_close($ds); } else { echo Unable to connect to LDAP server; } ? Which produces the following segment of debugging output on the ldap server, started with slapd -d 255. dn2entry_r: dn: CN=SHNETADMIN,O=SHNETDEMO = dn2id( CN=SHNETADMIN,O=SHNETDEMO ) cache_find_entry_dn2id(CN=SHNETADMIN,O=SHNETDEMO): 3 (1 tries) = dn2id 3 (in cache) = id2entry_r( 3 ) cache_find_entry_id( 3 ) cn=ShnetAdmin,o=shnetdemo (found) (1 tries) = id2entry_r( 3 ) 0x80e72a8 (cache) cache_return_entry_r( 3 ): returned (0) send_ldap_result: conn=12 op=1 p=2 send_ldap_result: 21::mail: value #0 invalid per syntax send_ldap_response: msgid=2 tag=105 err=21 ber_flush: 47 bytes to sd 9 : 30 2d 02 01 02 69 28 0a 01 15 04 00 04 21 6d 61 0-...i(..!ma 0010: 69 6c 3a 20 76 61 6c 75 65 20 23 30 20 69 6e 76 il: value #0 inv 0020: 61 6c 69 64 20 70 65 72 20 73 79 6e 74 61 78 alid per syntax ldap_write: want=47, written=47 : 30 2d 02 01 02 69 28 0a 01 15 04 00 04 21 6d 61 0-...i(..!ma 0010: 69 6c 3a 20 76 61 6c 75 65 20 23 30 20 69 6e 76 il: value #0 inv 0020: 61 6c 69 64 20 70 65 72 20 73 79 6e 74 61 78 alid per syntax daemon: select: listen=6 active_threads=1 tvp=NULL daemon: activity on 1 descriptors daemon: activity on: 9r daemon: read activity on 9 connection_get(9) connection_get(9): got connid=12 connection_read(9): checking for input on id=12 ber_get_next ldap_read: want=1, got=1 : 30 0 ldap_read: want=1, got=1 : 05 . ldap_read: want=5, got=5 : 02 01 03 42 00 ...B. ber_get_next: tag 0x30 len 5 contents: ber_dump: buf=0x080e5fe0 ptr=0x080e5fe0 end=0x080e5fe5 len=5 : 02 01 03 42 00 ...B. ber_get_next ldap_read: want=1, got=0 -- PHP Database 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] Re: NULL value for variable
if you move your mouse over the Download Now section... what is the statusbar displaying?? Edward - Original Message - From: Narvaez, Teresa [EMAIL PROTECTED] To: 'Sanduhr' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 21, 2002 5:05 PM Subject: RE: [PHP] Re: NULL value for variable I comment it out but I got this error: Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 22 Could not get file list: You have an error in your SQL syntax near '' at line 1 Thanks for any help!. -Original Message- From: Sanduhr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 6:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: NULL value for variable that global $fileId; shouldn't be there in downloadfile.php Teresa Narvaez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... : Hello, : I am runnig php 4.1.1. In the configuration, register_globals is : ON. : I have two programs and I want to pass the value from fileId from one.php to : downloadfile.php. However, in downloadfile.php $fileId is NULL. What am I : missing? Thanks, -Teresa : : : one.php : td width=33% bgcolor=#FFDCA8 height=21 : p style=margin-left: 10 : font face=Verdana size=1 : a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? : Download Now : /a/font : /td : /tr : : downloadfile.php : ? : global $fileId; : : if ( ! is_numeric($fileId) ) : die (Invalid PictureNumber specified: ($fileId)); : : ? : : -- 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] Re: NULL value for variable
It seems that you use global where it is not needed- outside of any function First error because error_reporting is not set to 0 in php.ini so error_reporting valus includes E_WARNING. if you set error_reporting=0 in php.ini or error_reporting(0); in the script you will not receive the first warning but probably lose the second which is useful. Best regards, Andrey Hristov - Original Message - From: Narvaez, Teresa [EMAIL PROTECTED] To: 'Sanduhr' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 21, 2002 6:05 PM Subject: RE: [PHP] Re: NULL value for variable I comment it out but I got this error: Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 22 Could not get file list: You have an error in your SQL syntax near '' at line 1 Thanks for any help!. -Original Message- From: Sanduhr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 6:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: NULL value for variable that global $fileId; shouldn't be there in downloadfile.php Teresa Narvaez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... : Hello, : I am runnig php 4.1.1. In the configuration, register_globals is : ON. : I have two programs and I want to pass the value from fileId from one.php to : downloadfile.php. However, in downloadfile.php $fileId is NULL. What am I : missing? Thanks, -Teresa : : : one.php : td width=33% bgcolor=#FFDCA8 height=21 : p style=margin-left: 10 : font face=Verdana size=1 : a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? : Download Now : /a/font : /td : /tr : : downloadfile.php : ? : global $fileId; : : if ( ! is_numeric($fileId) ) : die (Invalid PictureNumber specified: ($fileId)); : : ? : : -- 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] Re: NULL value for variable
On Thu, 2002-02-21 at 08:16, Andrey Hristov wrote: It seems that you use global where it is not needed- outside of any function First error because error_reporting is not set to 0 in php.ini so error_reporting valus includes E_WARNING. if you set error_reporting=0 in php.ini or error_reporting(0); in the script you will not receive the first warning but probably lose the second which is useful. Best regards, Andrey Hristov Turning error_reporting() off while developing is probably one of the easiest ways to make your life suck--but to each his own. :) In this case, it's probably pointing right to the problem. What do you get from using 'print_r($_REQUEST)'? You should be able to access $_REQUEST['fileId']; Torben - Original Message - From: Narvaez, Teresa [EMAIL PROTECTED] To: 'Sanduhr' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 21, 2002 6:05 PM Subject: RE: [PHP] Re: NULL value for variable I comment it out but I got this error: Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 22 Could not get file list: You have an error in your SQL syntax near '' at line 1 Thanks for any help!. -Original Message- From: Sanduhr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 6:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: NULL value for variable that global $fileId; shouldn't be there in downloadfile.php Teresa Narvaez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... : Hello, : I am runnig php 4.1.1. In the configuration, register_globals is : ON. : I have two programs and I want to pass the value from fileId from one.php to : downloadfile.php. However, in downloadfile.php $fileId is NULL. What am I : missing? Thanks, -Teresa : : : one.php : td width=33% bgcolor=#FFDCA8 height=21 : p style=margin-left: 10 : font face=Verdana size=1 : a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? : Download Now : /a/font : /td : /tr : : downloadfile.php : ? : global $fileId; : : if ( ! is_numeric($fileId) ) : die (Invalid PictureNumber specified: ($fileId)); : : ? : : -- 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 -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: NULL value for variable
Hello, Thanks for your replies. I still cannot access the variable fileId :-(. I would appreatiate any more comments. Thanks in advance -Teresa Warning: Undefined index: fileId in /home/narvaez/public_html/ddownloadfile.php on line 6 Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 7 Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 8 Invalid PictureNumber specified: () one.php td width=33% bgcolor=#FFDCA8 height=21 p style=margin-left: 10 font face=Verdana size=1 a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? Download Now /a/font /td /tr downloadfile.php ? print_r ($_REQUEST['fileId']); if ( ! is_numeric($fileId) ) die (Invalid PictureNumber specified: ($fileId)); ? -Original Message- From: Lars Torben Wilson [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 1:52 PM To: Andrey Hristov Cc: Narvaez, Teresa; [EMAIL PROTECTED] Subject: Re: [PHP] Re: NULL value for variable On Thu, 2002-02-21 at 08:16, Andrey Hristov wrote: It seems that you use global where it is not needed- outside of any function First error because error_reporting is not set to 0 in php.ini so error_reporting valus includes E_WARNING. if you set error_reporting=0 in php.ini or error_reporting(0); in the script you will not receive the first warning but probably lose the second which is useful. Best regards, Andrey Hristov Turning error_reporting() off while developing is probably one of the easiest ways to make your life suck--but to each his own. :) In this case, it's probably pointing right to the problem. What do you get from using 'print_r($_REQUEST)'? You should be able to access $_REQUEST['fileId']; Torben - Original Message - From: Narvaez, Teresa [EMAIL PROTECTED] To: 'Sanduhr' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 21, 2002 6:05 PM Subject: RE: [PHP] Re: NULL value for variable I comment it out but I got this error: Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 22 Could not get file list: You have an error in your SQL syntax near '' at line 1 Thanks for any help!. -Original Message- From: Sanduhr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 6:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: NULL value for variable that global $fileId; shouldn't be there in downloadfile.php Teresa Narvaez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... : Hello, : I am runnig php 4.1.1. In the configuration, register_globals is : ON. : I have two programs and I want to pass the value from fileId from one.php to : downloadfile.php. However, in downloadfile.php $fileId is NULL. What am I : missing? Thanks, -Teresa : : : one.php : td width=33% bgcolor=#FFDCA8 height=21 : p style=margin-left: 10 : font face=Verdana size=1 : a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? : Download Now : /a/font : /td : /tr : : downloadfile.php : ? : global $fileId; : : if ( ! is_numeric($fileId) ) : die (Invalid PictureNumber specified: ($fileId)); : : ? : : -- 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 -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506
RE: [PHP] Re: NULL value for variable
On Thu, 2002-02-21 at 14:04, Narvaez, Teresa wrote: Hello, Thanks for your replies. I still cannot access the variable fileId :-(. I would appreatiate any more comments. Thanks in advance -Teresa Warning: Undefined index: fileId in /home/narvaez/public_html/ddownloadfile.php on line 6 Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 7 Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 8 ^^ Might that extra 'd' have something to do with it? If not... Invalid PictureNumber specified: () Can you copy and paste this as downloadfile.php and see what you get? pre ?php error_reporting(E_ALL); print_r($_SERVER); print_r($_REQUEST); ? /pre Torben one.php td width=33% bgcolor=#FFDCA8 height=21 p style=margin-left: 10 font face=Verdana size=1 a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? Download Now /a/font /td /tr downloadfile.php ? print_r ($_REQUEST['fileId']); if ( ! is_numeric($fileId) ) die (Invalid PictureNumber specified: ($fileId)); ? -Original Message- From: Lars Torben Wilson [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 1:52 PM To: Andrey Hristov Cc: Narvaez, Teresa; [EMAIL PROTECTED] Subject:Re: [PHP] Re: NULL value for variable On Thu, 2002-02-21 at 08:16, Andrey Hristov wrote: It seems that you use global where it is not needed- outside of any function First error because error_reporting is not set to 0 in php.ini so error_reporting valus includes E_WARNING. if you set error_reporting=0 in php.ini or error_reporting(0); in the script you will not receive the first warning but probably lose the second which is useful. Best regards, Andrey Hristov Turning error_reporting() off while developing is probably one of the easiest ways to make your life suck--but to each his own. :) In this case, it's probably pointing right to the problem. What do you get from using 'print_r($_REQUEST)'? You should be able to access $_REQUEST['fileId']; Torben - Original Message - From: Narvaez, Teresa [EMAIL PROTECTED] To: 'Sanduhr' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 21, 2002 6:05 PM Subject: RE: [PHP] Re: NULL value for variable I comment it out but I got this error: Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 22 Could not get file list: You have an error in your SQL syntax near '' at line 1 Thanks for any help!. -Original Message- From: Sanduhr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 6:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: NULL value for variable that global $fileId; shouldn't be there in downloadfile.php Teresa Narvaez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... : Hello, : I am runnig php 4.1.1. In the configuration, register_globals is : ON. : I have two programs and I want to pass the value from fileId from one.php to : downloadfile.php. However, in downloadfile.php $fileId is NULL. What am I : missing? Thanks, -Teresa : : : one.php : td width=33% bgcolor=#FFDCA8 height=21 : p style=margin-left: 10 : font face=Verdana size=1 : a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? : Download Now : /a/font : /td : /tr : : downloadfile.php : ? : global $fileId; : : if ( ! is_numeric($fileId) ) : die (Invalid PictureNumber specified: ($fileId)); : : ? : : -- 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 -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: NULL value for variable
why can't i see anywhere in this code what value: $row[PicNum]; contains? try: a href=downloadfile.php?fileId=1 instead of: a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? if, it's working then, then your error is there... Greets, Edward - Original Message - From: Narvaez, Teresa [EMAIL PROTECTED] To: 'Lars Torben Wilson' [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, February 21, 2002 11:04 PM Subject: RE: [PHP] Re: NULL value for variable Hello, Thanks for your replies. I still cannot access the variable fileId :-(. I would appreatiate any more comments. Thanks in advance -Teresa Warning: Undefined index: fileId in /home/narvaez/public_html/ddownloadfile.php on line 6 Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 7 Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 8 Invalid PictureNumber specified: () one.php td width=33% bgcolor=#FFDCA8 height=21 p style=margin-left: 10 font face=Verdana size=1 a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? Download Now /a/font /td /tr downloadfile.php ? print_r ($_REQUEST['fileId']); if ( ! is_numeric($fileId) ) die (Invalid PictureNumber specified: ($fileId)); ? -Original Message- From: Lars Torben Wilson [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 1:52 PM To: Andrey Hristov Cc: Narvaez, Teresa; [EMAIL PROTECTED] Subject: Re: [PHP] Re: NULL value for variable On Thu, 2002-02-21 at 08:16, Andrey Hristov wrote: It seems that you use global where it is not needed- outside of any function First error because error_reporting is not set to 0 in php.ini so error_reporting valus includes E_WARNING. if you set error_reporting=0 in php.ini or error_reporting(0); in the script you will not receive the first warning but probably lose the second which is useful. Best regards, Andrey Hristov Turning error_reporting() off while developing is probably one of the easiest ways to make your life suck--but to each his own. :) In this case, it's probably pointing right to the problem. What do you get from using 'print_r($_REQUEST)'? You should be able to access $_REQUEST['fileId']; Torben - Original Message - From: Narvaez, Teresa [EMAIL PROTECTED] To: 'Sanduhr' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 21, 2002 6:05 PM Subject: RE: [PHP] Re: NULL value for variable I comment it out but I got this error: Warning: Undefined variable: fileId in /home/narvaez/public_html/ddownloadfile.php on line 22 Could not get file list: You have an error in your SQL syntax near '' at line 1 Thanks for any help!. -Original Message- From: Sanduhr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 6:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: NULL value for variable that global $fileId; shouldn't be there in downloadfile.php Teresa Narvaez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... : Hello, : I am runnig php 4.1.1. In the configuration, register_globals is : ON. : I have two programs and I want to pass the value from fileId from one.php to : downloadfile.php. However, in downloadfile.php $fileId is NULL. What am I : missing? Thanks, -Teresa : : : one.php : td width=33% bgcolor=#FFDCA8 height=21 : p style=margin-left: 10 : font face=Verdana size=1 : a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? : Download Now : /a/font : /td : /tr : : downloadfile.php : ? : global $fileId; : : if ( ! is_numeric($fileId) ) : die (Invalid PictureNumber specified: ($fileId)); : : ? : : -- 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 -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: NULL value for variable
that global $fileId; shouldn't be there in downloadfile.php Teresa Narvaez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... : Hello, : I am runnig php 4.1.1. In the configuration, register_globals is : ON. : I have two programs and I want to pass the value from fileId from one.php to : downloadfile.php. However, in downloadfile.php $fileId is NULL. What am I : missing? Thanks, -Teresa : : : one.php : td width=33% bgcolor=#FFDCA8 height=21 : p style=margin-left: 10 : font face=Verdana size=1 : a href=downloadfile.php?fileId=?php echo $row[PicNum]; ? : Download Now : /a/font : /td : /tr : : downloadfile.php : ? : global $fileId; : : if ( ! is_numeric($fileId) ) : die (Invalid PictureNumber specified: ($fileId)); : : ? : : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] not null
if (empty($value)) { ... } On Wed, 1 Aug 2001, Craig Vincent wrote: When a field is declared as an integer, not null and is the primary, how would I address it's empty set? ex: if($value == ???) { bla bla bla } My condition wants there to be nothing in $value. Are you referring to the (INT, NOT NULL, PRIMARY) field being in a database? Sincerely, Craig Vincent -- 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] -- 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]
[PHP] not null
Hi, When a field is declared as an integer, not null and is the primary, how would I address it's empty set? ex: if($value == ???) { bla bla bla } My condition wants there to be nothing in $value. -- 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]
RE: [PHP] not null
When a field is declared as an integer, not null and is the primary, how would I address it's empty set? ex: if($value == ???) { bla bla bla } My condition wants there to be nothing in $value. Are you referring to the (INT, NOT NULL, PRIMARY) field being in a database? Sincerely, Craig Vincent -- 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]
Re: [PHP] not null
on 8/1/01 12:50 PM, Jeremy Morano at [EMAIL PROTECTED] wrote: Hi, When a field is declared as an integer, not null and is the primary, how would I address it's empty set? nut sure i understand the question. if the field is NOT NULL, how could $value be empty? ex: if($value == ???) { bla bla bla } My condition wants there to be nothing in $value. -- mike cullerton -- 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]
RE: [PHP] check null value
I would try: if (isset($fieldname) empty($fieldname)){ // do something here with the variable } else { $fieldname="na"; } // if (isset($fieldname) empty($fieldname)) Cal http://www.calevans.com -Original Message- From: Jacky@lilst [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 23, 2001 3:18 PM To: [EMAIL PROTECTED] Subject: [PHP] check null value If I have one input text box that when it is submitted to next page, I want to check first if it is nothing, then write "na" on next page, else just echo whatever it is, is it correct to do this? if ($fieldname == ""){ $fieldname ="na"; } ... (then come to the html bit below) td?php echo $fieldname ?/td I wonder specificly about the check if it is null part if it is corerct. Any thoughts? Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself" -- 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]
[PHP] check null value
If I have one input text box that when it is submitted to next page, I want to check first if it is nothing, then write "na" on next page, else just echo whatever it is, is it correct to do this? if ($fieldname == ""){ $fieldname ="na"; } ... (then come to the html bit below) td?php echo $fieldname ?/td I wonder specificly about the check if it is null part if it is corerct. Any thoughts? Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"