|
|
|
|
![]() ![]() |
Jul 9 2007, 06:54 PM
Post
#1
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 168 Joined: 21-March 06 From: Somewhere... Member No.: 20,464 |
I have an game/reward script that is written, but I can't get it to work. Can someone take a look at it and tell me what's wrong?
I'm getting: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/unspoke/public_html/darkfutures/slots.php on line 32 I attached the file below for you guys to take a look at. I'll be around.
Attached File(s)
|
|
|
|
Jul 9 2007, 07:31 PM
Post
#2
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 519 Joined: 9-February 07 Member No.: 38,519 |
Alright, i think i see your problem. From looking at the code, it looks like you are checking to see if the three variables match and if they do then you want to execute some more code to do that, right? Well, the way you are doing it is through the echo command to execute the code if i'm correct. The problem is, that when you execute the code using the echo command, you used " for everything, including the code you were trying to execute, so when you reached another ", it would bring up an error. I think a better way to do that, would be to cut out the echo statements and just do it normally (like in C++). Now, when I do this, I get more errors and am not sure if that's from not having all of your files (include statements) or if they are other errors, I beleive they are other variable errors; however, since I really am not the best at PHP, I'll leave it up to someone else to figure out.
I have attached the code I have modified for you to view.
Attached File(s)
|
|
|
|
Jul 9 2007, 07:48 PM
Post
#3
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 168 Joined: 21-March 06 From: Somewhere... Member No.: 20,464 |
Oops! Here's the other file that it calls to. It calls for a header and footer, but they aren't the problem.... I know it's the one section that's having issues since I get an error when it's coded:
CODE <?php if ($one==$two) { if ($two==$three) { echo " <?php echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; ?> ">\n"; if ($one=="images/slots/04.GIF") { echo " <?php echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; ?> ">\n"; } } } ?> But when it's coded like this: CODE <?php if ($one==$two) { if ($two==$three) { echo " <?php include('rand-cards.php')?> \n"; if ($one=="images/slots/04.GIF") { echo " <?php include('rand-cards.php')?> \n"; } } } ?> It works and nothing shows up... That include is to a randomizer script, and it works on every other page it's used on. Any further ideas? I'm trying to give you the best info I can.
Attached File(s)
|
|
|
|
Jul 10 2007, 02:58 PM
Post
#4
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 519 Joined: 9-February 07 Member No.: 38,519 |
I'm afraid I can't help anymore, I've only tapped PHP so i was looking at it from a C++ perspective. I wish you luck on finding the problem though.
|
|
|
|
Jul 12 2007, 07:43 AM
Post
#5
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 688 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
THe problem i see is your trying to echo php code and expect it to work
<?php if ($one==$two) { if ($two==$three) { echo " <?php From what i understand when you load a page all the php code has already been executed. so echoing another echo of <?php [code] ?> wont work. It would just get ouputed as plain text "<?php .....". So you will have to change your code so that it does not contain <?php tags inside a <?php tag <?php if ($one==$two) { if ($two==$three) { echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; if ($one=="images/slots/04.GIF") { echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; echo "<img src=" . $special[array_rand($special,1)] . $digits2[array_rand($digits2,1)] . ">\n"; } } } ?> let me know if it works. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 12th October 2008 - 11:26 AM |