Re: [PHP] Str to Int

2006-01-21 Thread Rick Emery
Quoting [EMAIL PROTECTED]: 3. if ($cardID = '' || is_int($cardID)) As someone mentioned, $cardID = '' makes an assignment, doesn't test for true/false. Change to $cardID == ''. And this statement SHOULD come up "true" as a whole because $cardID = '' should always be true (unless th

Re: [PHP] Str to Int

2006-01-20 Thread tg-php
Ok, some good points where made already, but let's pull it all together: 1. You should get in the habit of using $_GET[] instead of $HTTP_GET_VARS.. minor thing but worth noting (info at http://us2.php.net/reserved.variables) 2. case reserve: This, I believe, will treate "reserve" as a consta

Re: [PHP] Str to Int

2006-01-20 Thread Ron Eggler (Paykiosks)
Am Freitag, den 20.01.2006, 18:28 -0500 schrieb comex: > > if ($cardID=''||is_int($cardID)) > > Two problems with that statement: > First of all, this statement _sets_ cardID to '', and then (I think) > returns a false value since '' doesn't evaluate to true. You probably > wanted ==. hO

Re: [PHP] Str to Int

2006-01-20 Thread adriano ghezzi
well I don't well understand the problem hope these two snippets can solve your problem: i tested them seems fine file 1 form.php enter tour code   enter tour code user code     file 2 -- get_card.php Nuova pagina 1

Re: [PHP] Str to Int

2006-01-20 Thread comex
> if ($cardID=''||is_int($cardID)) Two problems with that statement: First of all, this statement _sets_ cardID to '', and then (I think) returns a false value since '' doesn't evaluate to true. You probably wanted ==. Second of all, now that $cardID is '', it certainly isn't an int. It isn't an

Re: [PHP] Str to Int

2006-01-20 Thread Ron Eggler (Paykiosks)
Am Freitag, den 20.01.2006, 16:08 -0700 schrieb Gerry Danen: > You probably want to do an is_int() first... > > After that, you know it's an int and treat it that way. Why do you > need to typecast it? > > BTW, change $cardID = $HTTP_GET_VARS[cardID]; to $cardID = > $_GET['cardID']; for PHP5 comp

Re: [PHP] Str to Int

2006-01-20 Thread Gerry Danen
You probably want to do an is_int() first... After that, you know it's an int and treat it that way. Why do you need to typecast it? BTW, change $cardID = $HTTP_GET_VARS[cardID]; to $cardID = $_GET['cardID']; for PHP5 compatibility... ;-) Gerry On 1/20/06, Ron Eggler (Paykiosks) <[EMAIL PROTECT

Re: [PHP] Str to Int

2006-01-20 Thread Ray Hauge
You should be able to typecast the variable like so: $cardID = (int)$cardID; You can also check which type it is showing up as with the function gettype(): http://www.php.net/manual/en/function.gettype.php Optionally you could use settype() to change the type of the variable: http://www.php.ne

[PHP] Str to Int

2006-01-20 Thread Ron Eggler (Paykiosks)
Hi, I need to do a type cast from string to int in folllowing code: [php] [/php] I need $cardID have converted to int. I thought it should work that way but it does not! But it's working if I'm putting [php] [/php] in there. I got card ID as a var that is passed as get like: [php] $cardID = $HTT