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

syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\ajax.php on line 6

hi i am trying to parse a a simple database having two rows.... and getting a syntax error... please help me to solve this... this is the code..


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (PHP_VERSION>='5')
  3.  require_once('domxml-php4-to-php5.php')
  4.  
  5. // Start XML file, create parent node
  6. $doc = domxml_new_doc("1.0");
  7. $node = $doc->create_element("stusdent");
  8. $parnode = $doc->append_child($node);
  9.  
  10. $host = "localhost"; 
  11. $user = "root"; 
  12. $pass = "*********"; 
  13. $database = "students"; 
  14.  
  15. mysql_connect("localhost", "root", "*********") or die(mysql_error()); 
  16.  mysql_select_db("students") or die(mysql_error()); 
  17.  $data = mysql_query("SELECT * FROM students_data") 
  18.  or die(mysql_error());  
  19.  
  20.  
  21.  
  22. // Select all the rows in the markers table
  23. $query = "SELECT * FROM students_data
  24.  WHERE 1";
  25. $result = mysql_query($query);
  26. if (!$result) {
  27.   die('Invalid query: ' . mysql_error());
  28. }
  29.  
  30. header("Content-type: text/xml");
  31.  
  32. // Iterate through the rows, adding XML nodes for each
  33. while ($row = @mysql_fetch_assoc($result)){
  34.   // ADD TO XML DOCUMENT NODE
  35.   $node = $doc->create_element("students_data");
  36.   $newnode = $parnode->append_child($node);
  37.  
  38.   $newnode->set_attribute("name", $row['name']);
  39.   $newnode->set_attribute("roll_number", $row['roll_number']);
  40.  
  41. }
  42.  
  43. $xmlfile = $doc->dump_mem();
  44. echo $xmlfile;
  45.  
  46. ?>
Jul 9 '11 #1
2 5402
johny10151981
1,059 1GB
need semicolon at the end of every statements
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (PHP_VERSION>='5')
  3. require_once('domxml-php4-to-php5.php')
  4.  
Jul 9 '11 #2
Thank u soo very much!!! :)
it worked!! :D
Jul 10 '11 #3

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

Similar topics

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",...
1
by: msara | last post by:
I cant understand the error of this programm <? php $email = $_REQUEST ; $message = $_REQUEST ; mail( "info@premierentals.com","Feedback Form Results",$message, "From: $email"...
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...
6
by: mushfiq | last post by:
hi.i have got a problem. error message: Parse error: syntax error, unexpected T_VARIABLE in c:\wamp\www\dynamic2.php on line 12 for the line:
4
by: Graviz | last post by:
I am gettin a error message on this script can someone help me. I can't see what is wrong. Thanks in advance for any help you can give me. here is the error and code. Parse error: syntax error,...
3
by: brkseven | last post by:
Looking for help with this Contact Form. The error is on line 1, but that' doesn't mean a lot, I think. In fact, a php syntax check passed it, but I was hoping for an easy syntax error, it looks...
4
by: 9139530 | last post by:
Hey, I'm getting the error: Parse error: syntax error, unexpected T_VARIABLE in Z:\home\baza\www\get2.php on line 7 with this code (have 2 pages , html-from page (reguser.php) and...
3
by: Neil Playdon | last post by:
Hi there, this is my first ever post so please go easy on me. I am currently getting the following error message "Parse error: syntax error, unexpected T_VARIABLE in...
3
by: SUNN | last post by:
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /Users/Sunn/Song/usersong/profile.php on line 113 This is the line 113 <script...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.