![]() |
Need Help
I have a table that is set to varchar(50) and I put both numbers and letter in it... now I cant figure out how to get this code to work..... i always returns string even with numbers..
PHP Code:
|
i'm not sure, but doesn't mean varchar(50) that it is always a string with 50 chars like: "12345 " is a string.
try !is_int(trim($userinfo[table])) but i'm not sure ;) |
I was thinking that. I just needed a second opinion. ;)
|
Hmm... doesnt work. Damn this is a pain...
|
in PHP there is no strict variable types: every string can be an integer and every integer can be a string.
eg. if you have a string like "45asda23" and use it as an integer, you can, php will convert it to 45. So what exactly trying to do with this code? In other words when you want your script to return "integer" result? if you want to return integer when there is no chars in the string except a number, you can use this: PHP Code:
PHP Code:
is_int checks the variable type only, not the context of variable.. Regard, Logician |
Also bear in mind, that like forms, MySQL will always return data as a string, even if the field is INT. So yes, is_numeric() is the best way to do this.
Another method would be: PHP Code:
|
Thank You.
|
All times are GMT. The time now is 04:26 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|