flyersman Posted June 16, 2008 Share Posted June 16, 2008 Hey everyone, I set up a basic code in a file. Basically in MySQL if w9 is = 1 it will say ON FILE! If it isnt, it will say NOT ON FILE! For some reason even though it is 1 for me, it says NOT ON FILE!. So th script thinks it isnt 1. Can anyone spot whats wrong here? Thanks <? $_POST=$mysql->doSelectAndGetRow("users","*","email='$session_email'"); if(strlen($_POST['state'])>2) { $_POST['state2']=$_POST['state']; $_POST['state']=""; } ?> <? $w9status = $_POST['w9'] ?> <p class="descrip">TRIMMED</p> <hr><br><br><b><?=$_POST['first_name']?></b>, your W9 (W8 for international users) is currently <? if ( $w9status == 1 ) { echo "ON FILE!"; } else { echo "NOT ON FILE!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/ Share on other sites More sharing options...
Lodius2000 Posted June 16, 2008 Share Posted June 16, 2008 "doSelectAndGetRow" are you using a database abstraction layer, what does this class do I think that would help Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/#findComment-566165 Share on other sites More sharing options...
.josh Posted June 16, 2008 Share Posted June 16, 2008 unless your doSelectAndGetRow is taking your post array and selecting info based on it and returning results into the same post array...which I don't really see why it would be (I'm not psychic, but honestly I've never seen anybody do something like that, lol) your post array is being assigned whatever is in that method call. Maybe nothing at all and it's returning true or false. In any case, by the time it gets to $w9status = $_POST['w9'] it's more than likely not assigning anything at all. Or at best, a boolean value (true/false). But again, I'm not psychic. Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/#findComment-566167 Share on other sites More sharing options...
flyersman Posted June 16, 2008 Author Share Posted June 16, 2008 Hey guys, im a noob at php. Someone else wrote this code for me, and I tried to put the w9status thing in there. But <?=$_POST['first_name']?> returns the text in first_name correctly. So I'd imagine $_POST['w9'] returns the integer in w9. Which is 1, 2, or 3. Any idea on how to fix this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/#findComment-566168 Share on other sites More sharing options...
flyersman Posted June 16, 2008 Author Share Posted June 16, 2008 Also, I changed the code to this and it still wont work. <? $_POST=$mysql->doSelectAndGetRow("users","*","email='$session_email'"); if(strlen($_POST['state'])>2) { $_POST['state2']=$_POST['state']; $_POST['state']=""; } ?> <p class="descrip">trim</p> <hr><br><br><b><?=$_POST['first_name']?></b>, your W9 (W8 for international users) is currently <? if ( $_POST['w9'] == 1 ) { echo "ON FILE!"; } else { echo "NOT ON FILE!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/#findComment-566169 Share on other sites More sharing options...
.josh Posted June 16, 2008 Share Posted June 16, 2008 okay, so what are you intentions here? You want a user to enter in something in a form, then take that value, search your database for it, and return a thumbs up if it finds it, thumbs down, if not? Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/#findComment-566170 Share on other sites More sharing options...
Stephen Posted June 16, 2008 Share Posted June 16, 2008 Maybe the $_POST variable is getting confused with the $_POST function thing? D: If you change the variable name from $_POST to something else, maybe it would work? Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/#findComment-566172 Share on other sites More sharing options...
flyersman Posted June 16, 2008 Author Share Posted June 16, 2008 Nevermind, im an idiot. It works. I was looking under the wrong account. Sorry about that. Quote Link to comment https://forums.phpfreaks.com/topic/110348-is-my-php-code-wrong/#findComment-566174 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.