R1der Posted October 11, 2006 Share Posted October 11, 2006 ok this is hard to explainI just made a game for my users. Basicly thay click alot of numbered links.i.e[code]<a href="#t=1&s=0#">0</a><a href="#t=1&s=1#">1</a><a href="#t=1&s=2#">1</a>[/code]Ok so i got a rand statement[code]<?$rand = rand(1,100);if($rand==1 || $rand==20 || $rand==25 || $rand==56 || $rand==72 || $rand==100) {echo "Wow you found a needle. Keep looking and see if you can find more. Remember the more needles you find the better the chance of winning.";$db->query("UPDATE users SET uNeedle=uNeedle+'1' WHERE uID='" . $user['uID'] . "'");} ?>[/code]ok now what i want it to do if the user gets the random number that echos "Wow you found a needle. Keep looking and see if you can find more. Remember the more needles you find the better the chance of winning." i want it to redirect them to say needle.php?view How can this be done?Hope this makes sence :(Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/ Share on other sites More sharing options...
HuggieBear Posted October 11, 2006 Share Posted October 11, 2006 Use a header redirect after you've updated the database.[code]<?phpif($rand==1 || $rand==20 || $rand==25 || $rand==56 || $rand==72 || $rand==100) {echo "Wow you found a needle. Keep looking and see if you can find more. Remember the more needles you find the better the chance of winning.";$db->query("UPDATE users SET uNeedle=uNeedle+'1' WHERE uID='" . $user['uID'] . "'");header("Location: needle.php?view");}?>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/#findComment-107368 Share on other sites More sharing options...
R1der Posted October 11, 2006 Author Share Posted October 11, 2006 Thanks for your reply. but i tried that one b4 i posted my problem on here.You see because the page dont refresh or anything when you click the links. it dont do anything really it just goes to say "needle.php#t=1&s=1#" and so on when clickin the links. that it but the page dont refreshDoes this make sence? if not you can goto [url=http://www.hcn-chat.com/needle.php]http://www.hcn-chat.com/needle.php[/url] to try this game to see what i mean. Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/#findComment-107370 Share on other sites More sharing options...
HuggieBear Posted October 11, 2006 Share Posted October 11, 2006 In that case I don't think I've understood what you're after.As for getting me to try it, that page is riddled with errors. I'd correct them first:[quote]Warning: main(../includes/inc-header.php): failed to open stream: No such file or directory in /home/fhlinux202/h/hcn-chat.com/user/htdocs/needle.php on line 3Warning: main(../includes/inc-header.php): failed to open stream: No such file or directory in /home/fhlinux202/h/hcn-chat.com/user/htdocs/needle.php on line 3Warning: main(../includes/inc-header.php): failed to open stream: No such file or directory in /home/fhlinux202/h/hcn-chat.com/user/htdocs/needle.php on line 3Warning: main(): Failed opening '../includes/inc-header.php' for inclusion (include_path='.:/usr/share/pear') in /home/fhlinux202/h/hcn-chat.com/user/htdocs/needle.php on line 3[/quote]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/#findComment-107374 Share on other sites More sharing options...
R1der Posted October 11, 2006 Author Share Posted October 11, 2006 Thats just a copy of the game. that isnt the main game the error is just because i dragged it there so you didn't have to signup to my game if ya wanna see it without the errors you can signup to my game you can goto [url=http://www.hcn-chat.com/game]www.hcn-chat.com/game[/url]Sorry about this. Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/#findComment-107377 Share on other sites More sharing options...
HuggieBear Posted October 11, 2006 Share Posted October 11, 2006 OK, let me see if I've got this correct...The page loads, you click links on the page, this is meant to generate a random number using php and check if the random number is one of the needles. If it is, it adds one to their total in the database and then redirects them to needle.php?viewRegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/#findComment-107381 Share on other sites More sharing options...
R1der Posted October 11, 2006 Author Share Posted October 11, 2006 yes. well thats how i wanted it to work lol Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/#findComment-107382 Share on other sites More sharing options...
R1der Posted October 11, 2006 Author Share Posted October 11, 2006 Ok thanks for your reply huggie. i have now solved the problem. i just changed the links to goto somewhere else. like needles.php?stp=1 and so on. damnit was so simple. sorry to have wasted your time Quote Link to comment https://forums.phpfreaks.com/topic/23653-can-this-be-done/#findComment-107386 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.