943,928 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 522
  • PHP RSS
Nov 19th, 2008
0

Parse error: parse error, unexpected T_STRING in /home/content/d/r/a/dragun/html/vote

Expand Post »
Hi

i have made a stupid mistake in my code which i cannot find,and i am getting this error
Parse error: parse error, unexpected T_STRING in /home/content/d/r/a/dragun/html/vote.php on line 107

According to my eye sight it should be o.k. but apparently not. Can anyone give a helping hand. As far as i know all by curly brackets and semi colons are in place.

line 107 is nearly at the end and i wrote the line number text to it so one could know which line it is

thank you


php Syntax (Toggle Plain Text)
  1. <?php
  2.  
  3. // Connects to your Database
  4.  
  5.  
  6. mysql_connect("p50mysql293.secureserver.net", "dragonfire1", "Panther1") or die(mysql_error());
  7. mysql_select_db("dragonfire1") or die(mysql_error());
  8.  
  9.  
  10.  
  11.  
  12. //Name of our cookie
  13. //$cookie = "Voted";
  14.  
  15. //A function to display our results - this refrences vote_pie.php which we will also make
  16. function pie ()
  17. {
  18. $data = mysql_query("SELECT * FROM votes")
  19. or die(mysql_error());
  20. $result = mysql_fetch_array( $data );
  21. $total = $result[first] + $result[sec] + $result[third] + $result[forth] +$result[fifth] + $result[sixth] + $result[seventh] + $result[eighth] + $result[ninth] + $result[tenth] + $result[eleventh];
  22. $one = round (360 * $result[first] / $total);
  23. $two = round (360 * $result[sec] / $total);
  24. $three = round (360 * $result[third] / $total);
  25. $four = round (360 * $result[fourth] / $total);
  26. $five = round (360 * $result[fifth] / $total);
  27. $six = round (360 * $result[six] / $total);
  28. $seven = round (360 * $result[seventh] / $total);
  29. $eight = round (360 * $result[eighth] / $total);
  30. $nine = round (360 * $result[ninth] / $total);
  31. $ten = round (360 * $result[tenth] / $total);
  32. $per1 = round ($result[first] / $total * 100);
  33. $per2 = round ($result[sec] / $total * 100);
  34. $per3 = round ($result[third] / $total * 100);
  35. $per4 = round ($result[forth] / $total * 100);
  36. $per5 = round ($result[fifth] / $total * 100);
  37. $per6 = round ($result[sixth] / $total * 100);
  38. $per7 = round ($result[seventh] / $total * 100);
  39. $per8 = round ($result[eighth] / $total * 100);
  40. $per9 = round ($result[ninth] / $total * 100);
  41. $per10 = round ($result[tenth] / $total * 100);
  42. $per11 = round ($result[eleventh] / $total * 100);
  43. echo "<img src=vote_pie.php?one=".$one."&two=".$two."&three=".$three."four=".$four."&five=".$five."&six=".$six."&seven".$seven."&eight".$eight."&nine".$nine."&ten=".$ten."><br>";
  44. Echo "<font color=ff0000>Results Page</font> = $result[first] vote, $per1 %<br>
  45. <font color=0000ff>Circulars Page </font> = $result[sec] vote, $per2 %<br>
  46. <font color=00ff00>Training Schedule Page </font> = $result[third] vote, $per3 %<br>
  47. <font color=00ff00>Front Page </font> = $result[forth] vote, $per4 %<br>
  48. <font color=00ff00>Events/News</font> = $result[fifth] vote, $per5 %<br>
  49. <font color=00ff00>Shop</font> = $result[sixth] vote, $per6 %<br>
  50. <font color=00ff00>Trips Abroad</font> = $result[seventh] vote, $per7 %<br>
  51. <font color=00ff00>Links </font> = $result[eighth] vote, $per8 %<br>
  52. <font color=00ff00>Games </font> = $result[ninth] vote, $per9 %<br>
  53. <font color=00ff00>Football Club</font> = $result[tenth] vote, $per10 %<br>
  54. <font color=00ff00>Sports Club</font> = $result[eleventh] vote, $per11 %<br>";
  55. }
  56.  
  57. //This runs if it is in voted mode
  58. if ( $mode=="voted")
  59. {
  60.  
  61. //makes sure they haven't already voted
  62. if(isset($_COOKIE[$cookie]))
  63. {
  64. Echo "Sorry You have already voted this month<br>";
  65. }
  66.  
  67. //sets a cookie
  68. else
  69. {
  70. $month = 2592000 + time();
  71. setcookie(Voted, Voted, $month);
  72.  
  73. // adds their vote to the database
  74. switch ($vote)
  75. {
  76. case 1:
  77. mysql_query ("UPDATE votes SET first = first+1");
  78. break;
  79. case 2:
  80. mysql_query ("UPDATE votes SET sec = sec+1");
  81. break;
  82. case 3:
  83. mysql_query ("UPDATE votes SET third = third+1");
  84. break;
  85. case 4:
  86. mysql_query ("UPDATE votes SET forth = forth+1");
  87. break;
  88. case 5:
  89. mysql_query ("UPDATE votes SET fifth = fifth+1");
  90. break;
  91. case 6:
  92. mysql_query ("UPDATE votes SET sixth = sixth+1");
  93. break;
  94. case 7:
  95. mysql_query ("UPDATE votes SET seventh = seventh+1");
  96. break;
  97. case 8:
  98. mysql_query ("UPDATE votes SET eighth = eighth+1");
  99. break;
  100. case 9:
  101. mysql_query ("UPDATE votes SET ninth = ninth+1");
  102. break;
  103. case 10:
  104. mysql_query ("UPDATE votes SET tenth = tenth+1");
  105. break;
  106. case 11
  107. [B]mysql_query ("UPDATE votes SET eleventh = eleventh+1"); line 107[/B]}
  108.  
  109. //displays the poll results
  110. pie ();
  111. }
  112. }
Last edited by peter_budo; Nov 20th, 2008 at 12:58 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Light Poster
dragon@dragon64 is offline Offline
37 posts
since Oct 2007
Nov 19th, 2008
1

Re: Parse error: parse error, unexpected T_STRING in /home/content/d/r/a/dragun/html/

You have omitted column ( : ) on case 11, and the break statement after it.
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006
Nov 19th, 2008
0

Re: Parse error: parse error, unexpected T_STRING in /home/content/d/r/a/dragun/html/vote

Thank you just the same i managed to find my mistake,
I forgot to type the colon after the case 11 in line 106
Reputation Points: 10
Solved Threads: 0
Light Poster
dragon@dragon64 is offline Offline
37 posts
since Oct 2007
Nov 19th, 2008
0

Re: Parse error: parse error, unexpected T_STRING in /home/content/d/r/a/dragun/html/

Click to Expand / Collapse  Quote originally posted by Rhyan ...
You have omitted column ( : ) on case 11, and the break statement after it.
Thank you
Reputation Points: 10
Solved Threads: 0
Light Poster
dragon@dragon64 is offline Offline
37 posts
since Oct 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: How to give security image
Next Thread in PHP Forum Timeline: Calling an object within a class.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC