Connecting Tech Pros Worldwide Forums | Help | Site Map

I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in

Newbie
 
Join Date: Oct 2008
Posts: 16
#1: Oct 31 '08
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19

I got this error and this syntax is from 8 to 19th line.


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.             $subject_set = get_all_subjects();
  3.             while ($subject = mysql_fetch_array($subject_set)) {
  4.                 echo "<li>{$subject["menu_name"]}</li>";
  5.                 $page_set = get_pages_for_subject($subject["id"]);
  6.                 echo "<ul class=\"pages\">";
  7.                 while ($page = mysql_fetch_array($page_set)) {
  8.                     echo "<li>{$page["menu_name"]}</li>";
  9.                 }
  10.                 echo "</ul>";
  11.             }
  12.             ?>
end of 19th line.
I'd be your slave after this so please help me.

Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,952
#2: Oct 31 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


With PHP, you're lucky if the error is on the line it tells you.

Post the full code, so we can match up the line numbers.

Remember to use [code] tags! (just highlight your code, then hit the # button on the editor).

Cheers.
Newbie
 
Join Date: Oct 2008
Posts: 16
#3: Oct 31 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Thanx.

I really think theres no parenthesis missing in this code. since i've been figuring this since yesterday. And I really need help.

Expand|Select|Wrap|Line Numbers
  1. <?php require_once("includes/connection.php"); ?>
  2. <?php require_once("includes/functions.php"); ?>
  3. <?php include("includes/header.php"); ?>
  4.     <table id=structure>
  5.         <tr>
  6.         <td id="navigation">
  7.             <ul class="subjects">
  8.             <?php
  9.             $subject_set = get_all_subjects();
  10.             while ($subject = mysql_fetch_array($subject_set)) {
  11.                 echo "<li>{$subject["menu_name"]}</li>";
  12.                 $page_set = get_pages_for_subject($subject["id"]);
  13.                 echo "<ul class=\"pages\">";
  14.                 while ($page = mysql_fetch_array($page_set)) {
  15.                     echo "<li>{$page["menu_name"]}</li>";
  16.                 }
  17.                 echo "</ul>";
  18.             }
  19.             ?>
  20.             </ul>
  21.         </td>
  22.         <td id="page">
  23.             <h2>About Us</h2>
  24.  
  25.         </td>
  26.         </tr>
  27.     </table>
  28. <?php require("includes/footer.php"); ?>
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,952
#4: Oct 31 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Silly us! Looking back at the error, it says the problem is with C:\wamp\www\study_group\includes\functions.php.

So, post up the code from that file.

Cheers.
Newbie
 
Join Date: Oct 2008
Posts: 16
#5: Oct 31 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     function confirm_query($result_set) {
  3.         if (!$result_set) {
  4.             die("Database query failed: " . mysql_error());
  5.             }
  6.     }
  7.  
  8.     function get_all_subjects() {
  9.         global $connection;
  10.         $query = "SELECT *
  11.                 FROM subjects
  12.                 ORDER BY position ASC";
  13.         $subject_set = mysql_query($query, $connection);
  14.         confirm_query($subject_set);
  15.         return $subject_set;
  16.     }
  17.  
  18.     function get_pages_for subject($subject_id) {
  19.         global $connection;
  20.             $query = "SELECT *
  21.                     FROM pages
  22.                     WHERE subject_id = {$subject_id}
  23.                     ORDER BY position ASC";
  24.             $page_set = mysql_query($query, $connection);
  25.             confirm_query($page_set);
  26.             return $page_set;
  27.         }
  28. ?>
My mistake I didnt put it from the start. i was looking at the above page since Its were the error is. and i've also check this file too.
Or i'm just so new to php.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,952
#6: Oct 31 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Check out line 18. Look at the function name.

I'm not giving answers today! I'm giving hints.

:P
Newbie
 
Join Date: Oct 2008
Posts: 16
#7: Oct 31 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


It got me days to find out that an underscore is a problem.
God bless you Markus

And oh I'm sorry. I'm not sure if i'd be willing to be your slave.
since you only give me the hint. :P

Thanx.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,952
#8: Oct 31 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Quote:

Originally Posted by benicio

It got me days to find out that an underscore is a problem.
God bless you Markus

And oh I'm sorry. I'm not sure if i'd be willing to be your slave.
since you only give me the hint. :P

Thanx.

I have lawyers on standby. Refuse what you promised me, and be thrown to the dogs!
Newbie
 
Join Date: Oct 2008
Posts: 16
#9: Nov 1 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Mercy please. Have mercy.. Woohff woohff!
I can be your dog instead!

Anyway, please provide me a link to the instructions to manupulate the GUI of the phpadmin.
It dont seem right, dyou know what are syntax to write in the console to make my links visible?
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,952
#10: Nov 1 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Quote:

Originally Posted by benicio

Mercy please. Have mercy.. Woohff woohff!
I can be your dog instead!

Anyway, please provide me a link to the instructions to manupulate the GUI of the phpadmin.
It dont seem right, dyou know what are syntax to write in the console to make my links visible?

A dog will do. For now.

@ second part. Huh? I don't understand your question. Also, if this question has nothing to do with the original thread: post a new thread asking the question.

Best regards,
Your owner,
Mark.
Newbie
 
Join Date: Oct 2008
Posts: 16
#11: Nov 1 '08

re: I got this Parse error: syntax error, unexpected T_STRING, expecting '(' in


Okay. But then I'm gonna do that later. I think I'm gonna have to do and learn this on my own for now. After all you don't need a dog, you actually own lots of dogs here.
Reply