RES: [PHP-DB] input field validation
It'd be simpler to use isNaN() Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] ExcelĂȘncia em Softwares Financeiros -Mensagem original- De: sahabettin akca [mailto:[EMAIL PROTECTED] Enviada em: domingo, 11 de maio de 2008 14:31 Para: php-db@lists.php.net Assunto: Re: [PHP-DB] input field validation hi, *javascript function : function isNumber(obj) { var len = obj.value.length; var lastChar = obj.value.charAt(len-1); if( lastChar != '0' lastChar != '1' lastChar != '2' lastChar != '3' lastChar != '4' lastChar != '5' lastChar != '6' lastChar != '7' lastChar != '8' lastChar != '9' ) { obj.value = obj.value.substring(0, len-1); } } this is function use : input *onKeyUp='isNumber(this)' / do not alert , but add alert * obj.value = obj.value.substring(0, len-1); --- this line before --- alert('this field only integer!'); * add. good luck ?ahabettin akca (saho) 2008/5/11 arafat uddin [EMAIL PROTECTED]: - and this database field data type select int (integer) , tinyint, int, bigint... or if(gettype($_POST['field'])!=integer) // or if(intval($_POST['field'])==0) or if(!intval($_POST['field'])) { printnot integer; location(header: .php); #or printmeta http-equiv='refresh' content='0;url=.php'; } else { } 2008/5/11 Yves Sucaet [EMAIL PROTECTED]: Allow me to point out that this is not database-related... This website should get you everything you want: http://www.acmesoffware.com/acme/ExamplesJS/jsExm_ValidateInteger.asp HTH, Yves - Original Message - From: arafat uddin [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Sunday, May 11, 2008 12:48 AM Subject: [PHP-DB] input field validation hi, i want to input only integer in my field.if without integer any input put in the field it will show warning messege. such as 12 will be accept but 12sds will not accept . fhe34 will not accept plz help me by any javascript code. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- ?ahabettin akca // saho -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP-DB] input field validation
Nope, it's not. The problem was formulated as Integer detection. not numerical detection in general. isNaN will return positive for e.g. floating point values as well. The solutions described in this thread all result in integer-only values. All solutions presented are still off-topic, of course... Yves -- Original Message -- Received: Mon, 12 May 2008 11:12:02 AM CDT From: Thiago Pojda [EMAIL PROTECTED] To: 'sahabettin akca' [EMAIL PROTECTED],php-db@lists.php.net Subject: RES: [PHP-DB] input field validation It'd be simpler to use isNaN() Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] ExcelĂȘncia em Softwares Financeiros -Mensagem original- De: sahabettin akca [mailto:[EMAIL PROTECTED] Enviada em: domingo, 11 de maio de 2008 14:31 Para: php-db@lists.php.net Assunto: Re: [PHP-DB] input field validation hi, *javascript function : function isNumber(obj) { var len = obj.value.length; var lastChar = obj.value.charAt(len-1); if( lastChar != '0' lastChar != '1' lastChar != '2' lastChar != '3' lastChar != '4' lastChar != '5' lastChar != '6' lastChar != '7' lastChar != '8' lastChar != '9' ) { obj.value = obj.value.substring(0, len-1); } } this is function use : input *onKeyUp='isNumber(this)' / do not alert , but add alert * obj.value = obj.value.substring(0, len-1); --- this line before --- alert('this field only integer!'); * add. good luck ?ahabettin akca (saho) 2008/5/11 arafat uddin [EMAIL PROTECTED]: - and this database field data type select int (integer) , tinyint, int, bigint... or if(gettype($_POST['field'])!=integer) // or if(intval($_POST['field'])==0) or if(!intval($_POST['field'])) { printnot integer; location(header: .php); #or printmeta http-equiv='refresh' content='0;url=.php'; } else { ... } 2008/5/11 Yves Sucaet [EMAIL PROTECTED]: Allow me to point out that this is not database-related... This website should get you everything you want: http://www.acmesoffware.com/acme/ExamplesJS/jsExm_ValidateInteger.asp HTH, Yves - Original Message - From: arafat uddin [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Sunday, May 11, 2008 12:48 AM Subject: [PHP-DB] input field validation hi, i want to input only integer in my field.if without integer any input put in the field it will show warning messege. such as 12 will be accept but 12sds will not accept . fhe34 will not accept plz help me by any javascript code. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- ?ahabettin akca // saho -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] regarding the handling of resource type data in PHP extensions
Hi All, I am involved in writing a mapper extension wherein I take a api of mysql extension like mysql_connect() and map it to db2_connect() and then connect to the database and return the connection handle to the script(.php file). The *problem involved* is with the *resource types*. In the connection handle structure of my extension there is a field which is the *pointer* to the *db2 connection handle*(conn_handle *connection).After I establish the connection to the database and then use the *connection handle* to *close* the connection to the database, I face problems.In the connection handle of my extension I have fileds like database,username,password etc which I am able to *access properly* but when I try to access the *db2 connection handle* fields through the *pointer*present in my connection handle structure (conn_handle *connection) I get segmentation fault. Is it that the an extension cannot return values(a resource type in my case) to another extension. Please do suggest what wrong I am doing. With Regards, Harsha
[PHP-DB] regarding the handling of resource types in PHP Extensions
Hi All, I am involved in writing a mapper extension wherein I take a api of mysql extension like mysql_connect() and map it to db2_connect() and then connect to the database and return the connection handle to the script(.php file). The *problem involved* is with the *resource types*. In the connection handle structure of my extension there is a field which is the *pointer* to the *db2 connection handle*(conn_handle *connection).After I establish the connection to the database and then use the *connection handle* to *close* the connection to the database, I face problems.In the connection handle of my extension I have fileds like database,username,password etc which I am able to *access properly* but when I try to access the *db2 connection handle* fields through the *pointer*present in my connection handle structure (conn_handle *connection) I get segmentation fault. Is it that the an extension cannot return values(a resource type in my case) to another extension. Please do suggest what wrong I am doing. With Regards, Harsha