I'm trying to make a very makeshift language system... Defined by GET. This is what I've got.. $lang == $_GET['lang']; if ($lang == "en") { $onlinetext1 == "visitors online"; $onlinetext2 == "visitor online"; } // Defines the different texts used later (in english) else if ($lang == "de") { $onlinetext1 == "Besucher online"; $onlinetext2 == "Besucher online"; } // Defines the different texts used later (in german) else { $onlinetext1 == "visitors online"; $onlinetext2 == "visitor online"; } // Singular or Plural? if ($total == "1") { $onlinetext3 == $onlinetext2; } else { $onlinetext3 == $onlinetext1; } // if the total is only '1' then we use the singular version, if its more than one, we use plural.. echo "document.write(\"<a href='$site_url' target='_blank'>$total $onlinetext3!</a>\");"; PHP: The $total variable (previously defined, which is fine..) prints just fine, but the $onlinetext3 variable does not.. Can anyone spot what I'm overlooking? Thanks for all help! Jack
You have comparison operators where I think you want assignment operators if ($total == "1") { $onlinetext3 == $onlinetext2; } else { $onlinetext3 == $onlinetext1; } PHP: should be if ($total == "1") { $onlinetext3 = $onlinetext2; } else { $onlinetext3 = $onlinetext1; } PHP:
Hi, thanks for the response... However, I see no difference in those PHP codes? >.< edit: oh! the == vs =... I'll give it a try! Jack
Yup you use 2 equals (==) when you want to compare to values(usually seen in the condition of if statements, as this is where comparisons occur), and you use a single equals (=) when you want to assign the right side of the equals to the left side of the equals. Hence == is a comparison operator and = is an assignment operator. e.g if($a == $b){ //do this if $a has the same value as $b } $a = $b //This has set the value of $b to the value of $a $a = "Hello"; //This has set the string "Hello" to $a PHP:
Ah! Your info was right methomps, however, the assignment operators had to be applied to every part of the code.. Thank you so much! How foolish of me >.< +Rep for your help, thanks again! Jack EDIT: Thanks wd_2k6! Sorted it just as you posted, but thanks anyway! +rep