By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,501 Members | 1,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,501 IT Pros & Developers. It's quick & easy.

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

P: 16
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.
Oct 31 '08 #1
Share this Question
Share on Google+
10 Replies


Markus
Expert 5K+
P: 6,050
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.
Oct 31 '08 #2

P: 16
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"); ?>
Oct 31 '08 #3

Markus
Expert 5K+
P: 6,050
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.
Oct 31 '08 #4

P: 16
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.
Oct 31 '08 #5

Markus
Expert 5K+
P: 6,050
Check out line 18. Look at the function name.

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

:P
Oct 31 '08 #6

P: 16
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.
Oct 31 '08 #7

Markus
Expert 5K+
P: 6,050
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!
Oct 31 '08 #8

P: 16
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?
Nov 1 '08 #9

Markus
Expert 5K+
P: 6,050
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.
Nov 1 '08 #10

P: 16
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.
Nov 1 '08 #11

Post your reply

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