[Solved] “if (x == 100) alert” not working in combination with keydown function?

You should put the code inside the callback function, otherwise the nummer will just be 0. $(document).keydown(function(e) { switch (e.which) { case 38: $(“#object”).stop().animate({ top: “10” }); nummer = 0; break; case 40: $(“#object”).stop().animate({ top: “200” }); nummer = 100; break; } if (nummer == 100) { //do something it does have the protected class! … Read more

[Solved] How can the current time be used as a conditional value in php?

Try this $time = strtotime(“now”); // You will get the current time in UNIX timestamp.. if(($time%2)==0){ header (‘Location: http://www.misitio1.com’); }else{ header (‘Location: http://www.misitio2.com’); } If you want to work on the value of the current hour or minute, $hr = date(“H”); //Change it depending on your wish, 12 hr or 24 hr time. This will … Read more

[Solved] While Loop In C++

Here’s the answer, you should prompt for input, then check the input using a while loop instead of IF-ELSE to make sure the user provided the answer you desired. This is actually a simple logic question tho. You may explore do-while loop too. #include <iostream> using namespace std; int main() { string item; float price; … Read more

[Solved] scanner in while loop [duplicate]

Let’s extract a method (ReadInteger) for it. Please, note, that we use int.TryParse instead of Convert.ToInt32 since user input is not necessary a valid integer private static int ReadInteger(String title = null) { if (!string.IsNullOrWhiteSpace(title)) Console.WriteLine(title); while (true) { if (int.TryParse(Console.ReadLine(), out int result)) return result; Console.WriteLine(“Sorry, the input is not a valid integer, try … Read more

[Solved] Inconsistency with else statements?

First off, note that if and else always apply to the single statement that follows them. You can use { } to group multiple statements into a single compound statement, but the conditional then applies to the single { … } statement. Consider these two equivalent statements: if (foo) { bar(); } if (foo) bar(); … Read more

[Solved] Comparison inside while loop c++

Use == not = if (num == 1) { system(“start C:\\test\\vw”); Sleep(2000); } else if (num == 2) { system(“start C:\\test\\vw2”); Sleep(2300); } else if (num == 3) { system(“start C:\\test\\vw3”); Sleep(1800); } == is for comparison, = is for assignment The reason why it always chooses the first option is because C++ (and C) … Read more

[Solved] Unexpected T_ELSE [closed]

This would be a lot simpler using a switch/case logic scheme. I have re-coded what you had up there using switch/case and this might be a good intro for you to learn switch/case. You had some extra ( ) in one of the if statements above. I hope this helps, friend: <? $unix_time = 6734; … Read more

[Solved] Always redirect me to admin.php [closed]

Sending something to the browser with echo”Your Login Name or Password is invalid”; does not make any sense before calling header(“location: invalid.html”); because you can’t send header information after you send payload. You should remove the echo-Line or the redirect will not work. In addition to that, session_register() is deprecated by PHP 5.3 and got … Read more