...

View Full Version : Whats wrong?



Crazydog
08-25-2006, 07:19 AM
if ($AB == 'On') {
if ($line == 'Front Sideline') {
$yc = 204;
}
if ($line == 'Back Sideline') {
$yc = 85;
}
if ($line == 'Front Hash' || $line == 'Back Hash') {
$yc = 206;
}
}

For some reason, this part of my code is causing me problems.
I know this, because I tested it over and over and figured out THIS is where the problem is coming from, and nowhere else.

The problem is this:

IF:
$AB is On
and
$line is Front Hash or Back Hash

the script doesnt work

I'll be glad to add a few more lines above or below, but I'm pretty sure the whole script won't be necessary because I get no errors and everything works fine UNLESS i use the choices stated above.

Darth Oinker
08-25-2006, 08:19 AM
if ($AB == 'On') {

if ($line == 'Front Hash' || $line == 'Back Hash') {
$yc = 206;
}
}



not sure, but try
if (($line == 'Front Hash') || ($line == 'Back Hash'))

Spookster
08-25-2006, 08:44 AM
In the future, please use a more descriptive subject when posting a question. See posting guidelines. (http://www.codingforums.com/postguide.htm)

NancyJ
08-25-2006, 11:08 AM
have you tried echoing the value of $yc? Saying 'the script doesnt work' isnt very descriptive but it would help you to track down what is causing it not to work - all that snippet does is set the value of a variable.

ronverdonk
08-25-2006, 11:34 AM
Could it be that $line is longer then the literal you used to test it?
E.g. run the following snippet and you'll see what I mean.


<?php
$a = 'FRONT ';
if ($a == 'FRONT') echo '1. Is okay ';
else echo '1. Not okay ';
if ($a == 'FRONT ') echo '2. Is okay';
else echo '2. Not okay';
?>
It will echo '1. Not okay 2. Is okay'.

Ronald :cool:

Glass Casket
08-25-2006, 04:19 PM
You mentionned this in your original post, but is $AB supposed to equal 'On' or 'ON'?

Crazydog
08-25-2006, 06:59 PM
@Darth:
Nope didn't work.

@Nancy:
It echoes out correctly.

@ron:
"Front Hash" works in other parts of the code, so that's not the problem.

@Glass:
It's On.
On works for Front/Back sideline but not Front/Back hash

GJay
08-25-2006, 07:39 PM
<?php
$line='Front Hash';
$AB='On';
if ($AB == 'On') {
if ($line == 'Front Sideline') {
$yc = 204;
}
if ($line == 'Back Sideline') {
$yc = 85;
}
if ($line == 'Front Hash' || $line == 'Back Hash') {
$yc = 206;
}
}
echo $yc;
?>

results in '206', as it should. The error isn't in this bit of code.

Crazydog
08-26-2006, 05:21 AM
where else would it be? The only other part with Front/Back hash works fine, unless $AB=On

I guess I could give someone the script to look at, but I don't want to post it, so if anyone wants it to look at and to help me, send me an email/PM

Anthony2oo4
08-26-2006, 02:35 PM
post the file so we can read it.

Crazydog
08-26-2006, 05:09 PM
Like I said, I wouldn't feel comfortable posting a script I spent ~a week coding....

I'll be fine if someone PMs/Emails me asking if they can look at it to help, but I don't want it just floating around here.

Anthony2oo4
08-26-2006, 06:45 PM
PM it to me then id havea look. cant make any promises though.

marek_mar
08-26-2006, 06:48 PM
What is "the error"?

Fumigator
08-26-2006, 06:52 PM
Crazydog our issue is you keep insisting there's something wrong with the code you posted, but you are being vague as to what exactly is wrong. When asked what the variable $yc is, you stated it is correct. So... what the heck? Maybe if you could explain the problem? The best you've said is "it's causing me problems", "the script doesn't work", and other generalities that don't give us any clue what the problem actually is.

EDIT: Yeah what Marek_mar said :)

NancyJ
08-26-2006, 09:37 PM
so, let me get this straight, you're perfectly comfortable accepting free help and solutions from experienced professionals; people willing to give up their free time to help you, but you're not comfortable posting your code because it took a week of your precious time?!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum