| | |
PHP Parse error: syntax error, unexpected T_VARIABLE
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 1
Reputation:
Solved Threads: 0
Hello
PHP Parse error: syntax error, unexpected T_VARIABLE in /home/mysite/public_html/guestbook/getdrawings.php on line 1
Need your suggestions to solve this problom
regards
PHP Parse error: syntax error, unexpected T_VARIABLE in /home/mysite/public_html/guestbook/getdrawings.php on line 1
PHP Syntax (Toggle Plain Text)
<?php $dir=opendir("data"); while ($file=readdir($dir)){ if(substr($file, -3) == "xml"){ print 'data/'.$file.'|'; } } closedir($dir); ?>
Need your suggestions to solve this problom
regards
•
•
•
•
PHP Parse error: syntax error, unexpected T_VARIABLE in /home/mysite/public_html/guestbook/getdrawings.php on line 1
PHP Syntax (Toggle Plain Text)
<?php
PHP Syntax (Toggle Plain Text)
php
So basically I just couldn't reproduce the error and was working for me fine.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
•
•
Hello
PHP Parse error: syntax error, unexpected T_VARIABLE in /home/mysite/public_html/guestbook/getdrawings.php on line 1
Dear sisree,
I try this script but show no error.
can u give me php.ini and server details
Help as an alias
I think programming is great................
Tour Travel weblink by me and about Tour ,
Go To My Home Page and I m in Webdevelopment.
I think programming is great................
Tour Travel weblink by me and about Tour ,
Go To My Home Page and I m in Webdevelopment.
•
•
Join Date: Aug 2009
Posts: 1
Reputation:
Solved Threads: 0
$connection = mysql_connect($host,$usernamee,$passwordd) or die ('Could not connect to server.');
$db = mysql_select_db($database,$connection) or die ('Could not select database.');
$sqlerror = mysql_error();
//The next line is where the error is, please help me out....
$sqlinsert = "INSERT INTO usercomments(namee, emailaddress, comments, datesent) VALUES ('".$fName."', '".$emaill."', '".$commentt."', '"$datee."')";
$sqlinsertt = mysql_query($sqlinsert) or die ('Could not insert record');
if($sqlinsertt)
{
echo '<br><br>RECORD INSERTED SUCCESSFULLY <br>';
}
else
{
echo '<br>Record cannot be inserted with Shipper Login:<br> ';
//echo 'error$sqlerror';
}
?>
$db = mysql_select_db($database,$connection) or die ('Could not select database.');
$sqlerror = mysql_error();
//The next line is where the error is, please help me out....
$sqlinsert = "INSERT INTO usercomments(namee, emailaddress, comments, datesent) VALUES ('".$fName."', '".$emaill."', '".$commentt."', '"$datee."')";
$sqlinsertt = mysql_query($sqlinsert) or die ('Could not insert record');
if($sqlinsertt)
{
echo '<br><br>RECORD INSERTED SUCCESSFULLY <br>';
}
else
{
echo '<br>Record cannot be inserted with Shipper Login:<br> ';
//echo 'error$sqlerror';
}
?>
•
•
•
•
$connection = mysql_connect($host,$usernamee,$passwordd) or die ('Could not connect to server.');
$db = mysql_select_db($database,$connection) or die ('Could not select database.');
$sqlerror = mysql_error();
//The next line is where the error is, please help me out....
$sqlinsert = "INSERT INTO usercomments(namee, emailaddress, comments, datesent) VALUES ('".$fName."', '".$emaill."', '".$commentt."', '"$datee."')";
$sqlinsertt = mysql_query($sqlinsert) or die ('Could not insert record');
if($sqlinsertt)
{
echo '<br><br>RECORD INSERTED SUCCESSFULLY <br>';
}
else
{
echo '<br>Record cannot be inserted with Shipper Login:<br> ';
//echo 'error$sqlerror';
}
?>
And did you not read my signature saying not to bump old topics. Also please use code tags as they can make it easier to read your post. As for your question, the following code should do the trick:
php Syntax (Toggle Plain Text)
$connection = mysql_connect($host,$usernamee,$passwordd) or die ('Could not connect to server.'); $db = mysql_select_db($database,$connection) or die ('Could not select database.'); $sqlerror = mysql_error(); $fName=mysql_real_escape_string($fName); $emaill=mysql_real_escape_string($emaill); $commentt=mysql_real_escape_string($commentt); $datee=mysql_real_escape_string($datee); $sqlinsert = "INSERT INTO usercomments(namee, emailaddress, comments, datesent) VALUES ('$fName', '$emaill', '$commentt', '$datee')"; $sqlinsertt = mysql_query($sqlinsert) or die ('Could not insert record'); if($sqlinsertt) { echo '<br><br>RECORD INSERTED SUCCESSFULLY <br>'; } else { echo '<br>Record cannot be inserted with Shipper Login:<br> '; //echo 'error$sqlerror'; } ?>
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
Join Date: Jul 2009
Posts: 40
Reputation:
Solved Threads: 3
•
•
•
•
Hello
PHP Parse error: syntax error, unexpected T_VARIABLE in /home/mysite/public_html/guestbook/getdrawings.php on line 1
PHP Syntax (Toggle Plain Text)
<?php $dir=opendir("data"); while ($file=readdir($dir)){ if(substr($file, -3) == "xml"){ print 'data/'.$file.'|'; } } closedir($dir); ?>
Need your suggestions to solve this problom
regards
try to use getcwd.
PHP Syntax (Toggle Plain Text)
$dirPath = getcwd(); Gets the current working directory $thePath = $dirPath.'/data/'; $dir=opendir($thePath);
Last edited by phpbeginners; Aug 22nd, 2009 at 12:12 am.
![]() |
Similar Threads
- syntax error, unexpected $end in ndex.php on line 127 (PHP)
- mail function parse error (PHP)
- Parse error: syntax error, unexpected T_VARIABLE (PHP)
- Annoying T_Variable error (PHP)
- error (PHP)
- PHP5 - MySQL Parse error: (PHP)
Other Threads in the PHP Forum
- Previous Thread: get_browser().....error
- Next Thread: Parse error: syntax error, unexpected T_VARIABLE in
| Thread Tools | Search this Thread |
# 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail memberships menu mlm multiple multipletables mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote rss script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validator variable video web xml youtube






