By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,708 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,708 IT Pros & Developers. It's quick & easy.

php if statement mysql field value help

P: 1
Hello all ! (my first post)

First its safe to assume that I have no idea what I am doing because you would be correct.

My problem is, I am working in a simple paypal ipn script and I have stored t or f (true or false) in mysql my_config field my_field

Now in the ipn script I need to know if that info in my_config >my_field is t or f

I have tried many variations like:

global $my_config;
if($my_field !== 't' ){ do this}
if($my_field !== 'f' ){ do this other}

Thought it worked till I tried f > it just assumed ? t and did t instead.

I then tried:
global $my_config;
if ($my_config['my_field'] != 't'){ do this}
if ($my_config[my_field'] != 't'){do this other}

I am probably a million miles off, and its probably been discussed before, but I really need some help.

Regards
Rochelle
Feb 10 '07 #1
Share this Question
Share on Google+
1 Reply


ronverdonk
Expert 2.5K+
P: 4,258
Welcome to The Scripts!

When you want to test a variable for a value, don't use the negative check, do the positive check, like this:
[php]if ($my_config['my_field'] == 't'){ do your things for the 't' value}
if ($my_config['my_field'] == 'f'){ do your things for the 'f' value}
[/php]
Ronald :cool:
Feb 10 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.