473,378 Members | 1,344 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,378 software developers and data experts.

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

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
10 5608
Markus
6,050 Expert 4TB
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
benicio
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
6,050 Expert 4TB
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
benicio
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
6,050 Expert 4TB
Check out line 18. Look at the function name.

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

:P
Oct 31 '08 #6
benicio
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
6,050 Expert 4TB
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
benicio
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
6,050 Expert 4TB
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
benicio
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

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

Similar topics

2
by: Stuart Rogers | last post by:
My hosting service uses PHP 4.3.10 and when I run a php script which works perfectly on my local lan linux server on my hosting service I get this error:- Parse error: parse error, unexpected...
6
by: Ehartwig | last post by:
I recently created a script for user verification, solved my emailing issues, and then re-created the script in order to work well with the new PHP 5 that I installed on my server. After...
6
by: Ben Allen | last post by:
Hi, Im currently getting the error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in...
19
by: so many sites so little time | last post by:
the table is head the colunm is called body <?php //show_site.php // This script retrieves blog entries from the database. // Address error handing. ini_set ('display_errors', 1);...
5
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword')...
1
epots9
by: epots9 | last post by:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/html/xxx.php on line xxx I get that message when i try to run my...
4
kestrel
by: kestrel | last post by:
I have some html code that is supposed to be displayed by php echo. But for some reason i keep getting a syntax error, and i cant figure out what is going on. Heres what i have <?php...
1
by: Phaelle | last post by:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' What does that error mean? I canīt find the mistake!! In another script, I have got another kind of mistake : parse...
5
by: jeddiki | last post by:
Hi, I am using the following regex to check for valid email addresses, but I am getting errors. if (preg_match('\^+@+\.{2,4}$\',$regex)){ echo "VALID"; } else { echo "INVALID";
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.