473,386 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

unexpected T_VARIABLE

Heyas,

I'm relatively new to php, and I have no clue as to where I have the syntax error in my php file. Wondering of you guys can help me out. Thanks!

Parse error: syntax error, unexpected T_VARIABLE in /home/ruckusin/public_html/projects/vote_form.php on line 35

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Displays voting form
  3. require_once("vote_config.php");
  4. $poll = $_GET['hockeypoll'];
  5. if (!is_numeric($poll))
  6.   {
  7.     die("Invalid poll");
  8.   }
  9.  
  10. // Look up the poll in the database
  11. $sql = "SELECT P.question, A.answer, A.answer_ID
  12.           FROM hockeypoll P, answer A
  13.          WHERE P.ID = $poll
  14.            AND A.ID = P.ID";
  15.  
  16. $result = mysql_query($sql, $db) or die ("mysql error: " . mysql_error());
  17. if (mysql_num_rows($result) == 0) 
  18.   {
  19.     die('Invalid poll');
  20.   }
  21.  
  22. // Show results if the user has voted
  23. if ($_COOKIE["poll_voted_$poll"]) 
  24.   {
  25.     header("Location: vote_tally.php?poll=$poll");
  26.     exit;
  27.   }
  28.  
  29. // Create the voting form
  30. $question_list = "";
  31. while ($row = mysql_fetch_array($result)) 
  32.   {
  33.     $question = $row['question'];
  34.     $question_list .= '<li><input name="answer" type="radio" value="' 
  35.                       $row['answer_ID'] . '"> ' . $row['answer']
  36.                       '</li>';
  37.   }
  38.  
  39. ?>
  40. <html>
  41. <head>Voting Form</head>
  42. <body>
  43. <span style="font-size: 12px;">
  44. <span style="font-weight: bold; font-size: 14px;">
  45.     Poll #<?php print $poll; ?>
  46. </span><br />
  47. <span style="font-weight: bold"><?php print $question; ?></span>
  48. <form action="vote_process.php" method="post">
  49. <ul style="list-style-type: none;">
  50. <?php print $question_list; ?>
  51. </ul>
  52. <input name="poll" type="hidden" value="<?php print $poll; ?>">
  53. <input name="" type="submit" value="Vote!">
  54. </form>
  55. </span>
  56. </body>
  57. </html>
  58.  
Feb 17 '10 #1
2 1117
Dormilich
8,658 Expert Mod 8TB
you’re missing the concatenation operators on lines #34 – #36
Feb 17 '10 #2
Hey thanks for the heads up. I was so tired and could not figure it out. Worked like a charm!
Feb 18 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: mooneater | last post by:
Hallo, ich bin neu mit dem Umgang mit PHP, und ich habe folgendes (siehe unten) programmiert. Nun erhalte ich bei Aufruf meiner PHP-Datei folgende Fehlermeldung: Parse error: parse error,...
2
by: aamer | last post by:
can anyone please help me, im getting a dumb: Parse error: syntax error, unexpected T_VARIABLE in /home/jeddah/public_html/lomar/cart/remove.php on line 5 in the following file, <?php...
4
by: bovanshi | last post by:
got this annoying error I'm completly new to php... and i have no clue what is wrong here, from what i can tell there is nothing rong with this code... but that isn't what the borwser say :P ...
10
by: kilo | last post by:
Someone please see what the problem is.. I have getting an error: Parse error: syntax error, unexpected T_VARIABLE, expecting '{' in /customers/test-dig.dk/test-dig.dk/httpd.www/database.inc.php on...
1
by: mdouble | last post by:
I'm a complete novice with HTML and PHP. Recently I purchased an auto responder that requires me to edit a PHP file during the installation process as per directions provided in a read me file. ...
6
by: Philth | last post by:
No doubt this has been covered lots in detail. I think I've almost got is sorted but for this one error. "Parse error: syntax error, unexpected T_VARIABLE in...
3
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the...
4
by: needhelp08 | last post by:
I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help. <?php $conn = @mysql_connect("localhost",...
8
by: illuzion | last post by:
ok I keep getting this error: Parse error: syntax error, unexpected T_VARIABLE in /home/illuzion/public_html/BAMF/contactus.php on line 38 and this error is possibly on other lines could...
7
by: ashraf02 | last post by:
i have check the code thoroughly to find the error i am still getting the following error: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Catalogue.php on line 23 <!DOCTYPE html...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.