Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Cannot Parse Php In Browser, Syntax Error


I'm getting started with PHP, and I'm got a simple database in MySQL and using php to display information from it. I have a script where I'm trying to display the following:

-first name
-last name
-address

When I parse the file with VIM, I get a syntax error line 20, but I'm not able to see/find my error. PHP Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Email Script/Javascript Parse Error: Syntax Error, Unexpected T_STRING
I've made a email script to include javascript. Now what I want to do, is that I want to hide the link in status bar when I hover over it. I've implemented javascript into the code but I keep getting the following error:

Parse error: syntax error, unexpected T_STRING in /home/****/public_html/fbmail/contact.php on line 12

Here is line 12:
$message .= '<a href="http://www.mysite.com/" onMouseOver="window.status='Click here to continue.'; return true;" onMouseOut="window.status=''; ">Click here to continue ..</a>'; The complete code:

Parse Error: Syntax Error, Unexpected T_ENCAPSED_AND_WHITESPACE, Expecting T_STR
I am having troubles entering this info into my db. Cna someone help? This is the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/realfina/public_html/ec/testdobaapi.php on line 22 Code:

Parse Error: Syntax Error, Unexpected '?' In /home/**/public_html/website_
Parse error: syntax error, unexpected '?' in /home/realfina/public_html/website_builder/phpcb/filgen.php on line 373

Can someone explain what this means?

Parse Error: Syntax Error, Unexpected T VARIABLE In
I can't figure this out I am posting the script as well if you see something wrong please send an email.

=====================================
<?php
$nume = $_POST['nume']
$prenume = $_POST['prenume']
$adresa = $_POST['adresa']
$telefon = $_POST['telefon']
$mobil = $_POST['mobil']
$A = $_POST['A']
$B = $_POST['B']
$C = $_POST['C']
$CE = $_POST['C+E']
$D = $_POST['D']
$zi = $_POST['zi']
$luna = $_POST['luna']
$an = $_POST['an']
$email = $_POST['email']
$comentarii = $_POST['comentarii']
$ip = getenv("REMOTE_ADDR");

$msg = "Nume: $nume
Prenume: $prenume
Adresa: $adresa
Telefon fix: $telefon
Mobil: $mobil
Categoria A: $A
CategoriaB: $B
CategoriaC: $C
CategoriaC+E: $CE
CategoriaD: $D
Data Nasterii: $zi-$luna-$an
IP: $ip";
$to = "email@example.com";
$subj = "candidat nou";
$from = "www.example.com";
mail ($to, $subj, $msg, $from);
header("Location: success.htm");
}
?>
===================================
error is Parse error: syntax error, unexpected T_VARIABLE in D:xampphtdocsestauto schoolsite_flashsend.php on line 4

Parse Error: Syntax Error, Unexpected T_OBJECT_OPERATOR
I got following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /xxx/xxx/public_html/xxxx/GeteBayOfficialTime.php on line 49

what's wrong with my syntax? GeteBayOfficialTime.php required be runned at PHP 5.x.x., but my web host said support php 4.4.4. I don't know whether I got error because this reason. Code:

Parse Error: Syntax Error, Unexpected $end In C:wampwwwsitescismv1
I keep getting a "Parse error: syntax error, unexpected $end in c:wampwwwsitescismv1contacts.php on line 227". Line 227 is the end of my code. From what I can tell from searching the web, it appears that there is something that is not concantenated correctly. I cannot find it though. Can anyone else see it?

Parse Error: Syntax Error, Unexpected $end In ..
The error message Parse error: syntax error, unexpected $end in FILE on
line X is one I run into frequently and I know the cause is I missed an
ending quote.

Is there an easy way to determine where the inital " started? I find
myself adding /* */ blocks or cutting/pasting sections of code out in
order to find where the error occured.

Wouldn't it it be nice if the warning message included the line in teh
source where the initial quote occured?

for example say this is my code
<?
function Build_Query(....)
code...

$my_query = "SELECT BLAH FROM ; (line 15)

more code...

} (line 100)
EOF

and you got

Parse error: syntax error, unexpected $end in MYFILE on line 100
started on line 15

Parse Error: Syntax Error, Unexpected
Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/hawkwebd/public_html/buy.php on line 2
what does this mean

Parse Error: Syntax Error ?
Does anyone know what this means? The file it is saying user.php is a class file however i think i got all the opening and closing braces.

QuoteParse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /*/*/*/*/includes/user.php on line 10

PHP Saying Error In Mysql Syntax, But Written My Mysql Query Browser!
I have a basic db that I access with MySQL query browser. Everything
seems fine to me but I am using this db as part of a php shopping
basket and when I try to add an item I get:

Notice: Query failed: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '>function.extract]: First argument should be an
array in functions.inc.php on line 31
Notice: Undefined variable: price in functions.inc.php on line 36
Notice: Undefined variable: price in functions.inc.php on line 39
Notice: Undefined variable: total in unctions.inc.php on line 39

I'm assuming the last three are caused by this problem as price should
be passed to the cart, and total is worked out using it. However
although I know mySQL code it was the MySQL query browser that
actually generated the code and I cannot see a way to view or debug
the code.

The db has one table in it which is made up of id, name, subname,
desc, and price.

The code in the php file that is being referred to is:

Parse Error: Parse Error, Unexpected T_STRING, Expecting ',' Or ';'
I've got error for this:

<td width="23%"><font face="Arial, Helvetica, sans-serif" size="1">
<?php echo online: $int_count;?>
</font></td>

Parse Error: Parse Error, Unexpected T_IF, Expecting ',' Or ''
I'm playing around with PHP's imap functions and I'm encountering a syntax error that I can't figure out completely.

Quote: Parse error: parse error, unexpected T_IF, expecting ',' or '' in /home/kingmike/docs/WEBMAIL/inbox.php on line 53 PHP Code:

Parse Error: Parse Error, Unexpected T_LNUMBER
what's wrong with this code?

line 19:
if($_POST['miners']*500+$_POST['magicians']*800+$_POST['knights']*1200+$_POST['rangers']*1500>$fdatabase['gold']){echo("false!");}

I got error:

Parse error: parse error, unexpected T_LNUMBER in /home/www/xyz.php on line 19

Parse Error</b>: Parse Error, Unexpected T_CONSTANT_ENCAPSED_STRING I
Someone please help me with this as i am getting the above errors.. in line 6 i..e mysql...

Parse Error: Parse Error, Unexpected T_STRING
I have edited a php script to pick up the data from a webform and convert it into a email and when i submit it i get a error.....

Parse error: parse error, unexpected T_STRING in /home/nas01l/f/flexamatic.com/user/htdocs/estore/sendmail9.php on line 6

the php is:

Parse Error: Parse Error, Unexpected T_STRING,
Can a class define a constant as Java or C does? I tried to define a constant by
define("AMAZING_VALUE", "1997"); but it prompts:

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'

Parse Error: Parse Error, Unexpected T_ELSE....
The code is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Club</title>
</head>
<style type="text/css">
body {margin : 0px;}
</style>
<body bgcolor="navy">
<font color="white">
Welkom in de winkel. Wat wilt u doen?<br>
<form action="club.php" method="post">
<input type="radio" name="keuzewinkel" value="1">Voer kopen<br>
<input type="radio" name="keuzewinkel" value="2">Bijproducten kopen<br>
<input type="radio" name="keuzewinkel" value="3">Medicijnen kopen<br>
<input type="radio" name="keuzewinkel" value="4">Praatje maken met de verkoper<br>
<input type="radio" name="keuzewinkel" value="5">Duiven verkopen / kopen<br>
&nbsp<br>
<input type="submit" value="Verder">
</form>
<?
if (isset($submit)) {
if ($keuzewinkel == &#391;') include('koopvoer.php')
else ($keuzewinkel == &#392;') include('koopbijproducten.php') <-- Line 25!!!!
else ($keuzewinkel == &#393;') include('koopmedicijnen.php')
else ($keuzewinkel == &#394;') include('chatverkoper.php')
else include('koopduiven.php')
}
?>
</body>
</html>

Parse Error: Parse Error, Unexpected T_LNUMBER,
i got a proplem with my array the error message is :

Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in D:xampphtdocsworksmartcontractorssites est.php on line 5 PHP Code:

Paging (Parse Error: Parse Error, Unexpected '.' )
I am trying to page my database records using php and i have written the script but somehow it is giving some weird error somewhee towards the end of the script. can anyone just check the code and tell me whether this will work(give a little attention to the A HREF tag) and how to remove the error that i am getting . The error that I am getting is

"Parse error: parse error, unexpected '.' in c:webpaging2.php on line 62" code:

Parse Error: Parse Error, Unexpected T_STRING
keep getting this errorParse error: parse error, unexpected
T_STRING in order_fns.php line 91. the code is below for the file and
I've indicated line 91

<?php
function process_card($card_details)
{
// connect to payment gateway or
// use gpg to encrypt and mail or
// store in DB if you really want to

return true;
}

function insert_order($order_details)
{
global $HTTP_SESSION_VARS;

//extract order_details out as variables
extract($order_details);

//set shipping address same as address
if(!$ship_name&&!$ship_address&&!$ship_city&&!$ship_state&&!$ship_zip&&!$ship_country)
{
$ship_name = $name;
$ship_address = $address;
$ship_city = $city;
$ship_state = $state;
$ship_zip = $zip;
$ship_country = $country;
}

$conn = db_connect();

//insert customer address
$query = "select customerid from customers where
name = '$name' and address = '$address'
and city = '$city' and state = '$state'
and zip = '$zip' and country = '$country'";
$result = mysql_query($query);
if(mysql_numrows($result)>0)
{
$customer_id = mysql_result($result, 0, 'customerid');
}
else
{
$query = "insert into customers values
('', '$name','$address','$city','$state','$zip','$count ry')";
$result = mysql_query($query);
if (!$result)
return false;
}
$query = "select customerid from customers where
name = '$name' and address = '$address'
and city = '$city' and state = '$state'
and zip = '$zip' and country = '$country'";
$result = mysql_query($query);
if(mysql_numrows($result)>0)
$customerid = mysql_result($result, 0, 'customerid');
else
return false;
$date = date('Y-m-d');
$query = "insert into orders values
('', $customerid, ".$HTTP_SESSION_VARS['total_price'].",
'$date', 'PARTIAL', '$ship_name',
'$ship_address','$ship_city','$ship_state','$ship_ zip',
'$ship_country')";
$result = mysql_query($query);
if (!$result)
return false;


Parse Error: Parse Error, Unexpected T_ELSE
I got the following error in my page Parse error: parse error,
unexpected T_ELSE in line 25

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Club</title>
</head>
<style type="text/css">
body {margin : 0px;}
</style>
<body bgcolor="navy">
<font color="white">
Welkom in de winkel. Wat wilt u doen?<br>
<form action="club.php" method="post">
<input type="radio" name="keuzewinkel" value="1">Voer kopen<br>
<input type="radio" name="keuzewinkel" value="2">Bijproducten
kopen<br>
<input type="radio" name="keuzewinkel" value="3">Medicijnen kopen<br>
<input type="radio" name="keuzewinkel" value="4">Praatje maken met de
verkoper<br>
<input type="radio" name="keuzewinkel" value="5">Duiven verkopen /
kopen<br>
&nbsp<br>
<input type="submit" value="Verder">
</form>
<?
if (isset($submit)) {
if ($keuzewinkel == &#391;') include('koopvoer.php')
else ($keuzewinkel == &#392;') include('koopbijproducten.php') <--------
line 25
else ($keuzewinkel == &#393;') include('koopmedicijnen.php')
else ($keuzewinkel == &#394;') include('chatverkoper.php')
else include('koopduiven.php')
}
?>
</body>
</html>

PHP Parse Error: Parse Error, Unexpected T_VARIABLE
I'm writing a fairly simple php script and I keep getting the message "PHP Parse error: parse error, unexpected T_VARIABLE".
I know that means I made a simple mistake somewhere, but syntax highlighting and checking have revealed nothing and I certainly not catch it with my own eye. I reformatted the whitespace to spaces and newlines only, so it has to be something that shows up on the screen.
here's the PHP portion in its entirety:

<%php
$socket = @mysql_connect("mysql","database","****");
if (mysql_select_db ("comments")) {
$sql = "SELECT * FROM register";
$query = mysql_query($sql, $socket);
while($data = mysql_fetch_object($query)) {
echo "<TR><TD> $data->name
$data->email
$data->aim
$data->known</TD></TR>";
}
}
%>

There is no other scripting on the page. The error is on the line with "$socket = @mysql_connect...". Could I have the ASP-style tags wrong?

Parse Error: Parse Error, Unexpected '='
I'm not sure where to look up the answer to this question myself, so
maybe you can help me.

The following line of code works fine with php5:

function CheckMappings(&$badMappings=array())

On a system with php4 the following error is thrown:

Parse error: parse error, unexpected '=', expecting ')' in <phpfileon
line 42

Now I would like to know, what the problem is. Is it the '&' or the
default value assignment or a combination of both?

Where would I find documentation on the differences in the versions of
php? Is there a good site? Maybe a table with a feature comparison?

Parse Error: Parse Error, Expecting `','' Or `';''
I'm getting the following error Parse error: parse error, expecting `','' or
`''' in /home/notarywe/public_html/php/update2.php on line 108

Here is line 108

<input type="text" name="ud_first" value="<? echo "$first"
size="20"?>"></td>

Parse Error: Parse Error, Expecting `']''
I've got this annoying error: Parse error: parse error, expecting `']'' PHP Code:

Parse Error: Parse Error, Unexpected $end
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 submitting user
information into my creation script, I get the following error from the
page that is suppose to insert the user data into the database, create
a code, then send an email out for verification.

Parse error: parse error, unexpected $end in
c:wampwww hreadcreateadd2tbl.php on line 31

Below are the files in which I am using:

add2tbl.php

<?php
require "mailfunctions.php";
$username = $_POST['username'];
$md5password2 = md5($_POST['pass2']);
$email = $_POST['email'];
$md5password = md5($_POST['pass']);
if(isset($_POST['username'])) {
if ($md5password == $md5password2) {
$db = dbc();
$code = codegen();
$user = insertuser($username, $md5password, $email, $code);
if ($user == FALSE) {
die("There has been an error in adding you to the Database. Please
EMail the admin.");
}
else {
echo "<b>Passwords do not match!</b> ";
}
include("/top.html");

$mail = mailauth($username);
if ($mail) {
echo '
<p class = "subtitle">Success! Check your email.</p>'
} else {
echo '
<p class = "subtitle">We are sorry. The request did not go through
successfully due to an error in the Mail server. Please contact the
Admin.</p>'

}
include("/bottom.html");
}
?>

mailfunctions.php

<?php
function dbc() {
mysql_connect(localhost, "root");
mysql_select_db("ehartwig1");
return TRUE;
}
function codegen() {
$code = rand(10000000000000,999999999999999);
return $code;
}
function insertuser($name,$md5password,$email,$code) {
$query = "INSERT INTO threadauth (username, password, email,
authcode) VALUES ('{$name}','{$md5password}','{$email}', '{$code}') or
return(FALSE)";
$result = mysql_db_query($query);
return $result;
}

Parse Error: Parse Error, Unexpected $ In
I have just solved the last problem. But now i get the error message

Parse error: parse error, unexpected $ in /homepages/12/d214897219/htdocs/adam/create_thumbnails.php on line 58. I dont know how to solve this. Code:

Parse Error: Parse Error, Expecting `','' Or `'''
Parse error: parse error, expecting `','' or `''' ....

Error Performing Query: You Have An Error In Your SQL Syntax Near
I have a query which pulls user info from a database table, and displays it in an HTML table. The user then has the ability to edit this data on the next page by clicking continue, where the first and last name are passed as variables, and are listed as uneditable, whereas all the other fields are able to be edited through a simple form.

Here's my problem, on the final page where the actual database UPDATE occurs, I'm getting a SQL error that looks like this
---------
Error performing query: You have an error in your SQL syntax near 'WHERE first_name='Joe' AND last_name='Schmoe' SET street_address_1='real address' at line 1
----------

It looks like its passing the first and last name fine (through hidden inputs), yet when I start to pass the edited fields as variables, it cuts off for some reason. The actual full value that I entered for "street_address_1" was "real address 333". It looks like it cut off after the "address", and didnt even bother to send the other 8 fields.

My code on the processing page looks like this
----------
$street_address_1_update=$_POST['street_address_1_update'];
$street_address_2_update=$_POST['street_address_2_update'];
$city_update=$_POST['city_update'];

$sql ="UPDATE mailing_list WHERE first_name='$first_name_update' AND last_name='$last_name_update' SET street_address_1='$street_address_1_update' street_address_2='$street_address_2_update' city='$city_update'"
----------
I only included 3 fields for brevity's sake. The rest pass the same way as these three. Again, the first and last names are simply passed as hidden inputs through the form.
Anybody have any clue what might be causing this? I know the error is a SQL one, but I may not be passing the variables correctly in PHP.

Redirect Error Reported As SQL Syntax Error
I just spent way too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way.

The purpose of the code is simply to delete a record and then redirect back to the page where the delete was started. The code looks like this:

elseif ($_GET[action] == "delete")
{
$query = "delete from product_subcategory2 where product_sku=$_GET[product_sku] and subcategory2_id=$_GET[subcategory2_id]";
$result = mysql_query($query) or die (mysql_error());
$affected_rows = mysql_affected_rows();

if ($affected_rows == 1)
{
header("Location:product.php?action=edit&product_sku=$product_sku");
}
else
{
do_header();
echo("<center><p class="body">Unable to delete Subcategory2. Please try again.</p>");
echo("<a href="product.php?action=edit&product_sku=$product_sku">Edit Product</a>");
do_footer();
}
}

The SQL was find, but the error I had was in the header line. What I had was this:

header("Location:product.php?action=edit&product_sku=<?php echo $product_sku?>");

so since I was already in PHP, I didn't need the "<?php echo" for $product_sku.

Parse Error When Trying To Parse XML
Trying to read in values from XML document and put them into an array in PHP, so I could use the different values to use in my PHP script... I am a beginner, so I decided to look and run some examples... well I always get this error in the 1st line... for some reason it doesnt liek the first line at all. PHP Code:

Syntax Error
Is it possible to use both Where and Order by in the same statement. Im pretty sure you can but i cant seem to get hte syntax right. Bewlos is the line im refering to:

$qry = "SELECT * FROM `$table` order by `$_GET[sortby]` desc limit $StartFrom, $Limit" WHERE `username` = "'.$session->username.'"'

Syntax Error?
Why does the following line create a Syntax error in PHP.

$Mac = ( (strstr($query,'Mac') || (strstr($query,'Mc') ||
(strstr($query,'M ') );

Syntax Error ???
on login.php , we can see that :

(...)

$sql = "SELECT Login FROM logins
WHERE Login='$fusername'";
$result = mysql_query($sql)
or die("Couldn't execute query1.");

(...)

field : login from table: logins

fusername is a valid form field.

I just can't understand why I get the message Couldn't execute query1.
I don't see any syntax error. :-(



SQL Syntax Error
Where is the error?

mysql_query("INSERT INTO list (status) VALUES ('$status') WHERE name = $name")or die(mysql_error());

Error In Your Sql Syntax
Could not run query: You have an error in your SQL Syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'character WHERE name = 'Chris" at line 1

Im getting this error with this code. I think the problem is... 'Chris"  (part in bold), but I can't fix it. Code below where error occures.

$result = mysql_query("SELECT guid FROM character WHERE name = '".$user."'");

I Get A Syntax Error Unexpected '>
Can someone please take a look a this code and give an idea what i'm soing wrong. I;m trying to deleate a record but I can do it.

<?
//session_start();
include_once("mysql_connect.php");
$myConn = connect_db();

$serviceid = $_POST['serviceid'];

$delete = mysql_query("DELETE * FROM service WHERE service_id = $serviceid);

mysql_query($strSQL, $myConn) or die (mysql_error());
echo "<script>alert('" . $intIndex . " Service Deleted!');</script>";
echo "<script>location.href='mycar.php'</script>";

?>

I get a syntax error unexpected '>'

Mysql / PHP : Syntax Error
for php syntax when i call Mysql database

I have wrote that and my sql connection is working

I just have a problem with this command line :

$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisateur='$login'";
$acces = mysql_query($query);

Syntax Error In Header...
Hi I am getting a sytax error in the following code but I cannot seem to find the problem.. Can anyone see where I am going wrong? PHP Code:

< In ' ' And PHP Shouts About Syntax Error :(
I`ve got a problem again:(
I almoust finished my project and I was doing stupid forms in html to display as
frontend. I have something like that:
<?php
$wyswietl[] = '
<html>

and php shouts:

<b>Parse error</b>: parse error, unexpected '<' in <b>D:IncomingWWWetak.pl
developer_d
isplay.inc</b> on line <b>3</b><br />
:((
I was sure that a variable can have >1 lines

You Have An Error In Your SQL Syntax; (@ Symbol?)
I'm getting this error at the mo... not overly useful... Is there a problem with the @ symbol?

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hotmail.com' at line 1

Mysql Syntax Error
what is wrong with this statemnet: $query = 'SELECT * FROM products WHERE id = '.$id.' AND boy = '.$boyGirl.' OR girl = '.$boyGirl; what do i do to fix it?

SQL Syntax Error With PHP Variables
I'm getting the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'div, writer, sme, progress, status, due) VALUES (Test Project,test description,t' at line 1

Based on this code:

Not Showing Syntax Error
I have a prb that when i run any web page and if it contains an syntax error. then nothing is displayed. I mean page is blanked. what need to change in php.ini.

Syntax Error Using Register Globals
Hi. Everytime I try and use these globals like this:

Trouble With UPDATE - You Have An Error In Your SQL Syntax
I'm having some trouble getting my database to update. This is my first attempt at PHP and MySQL and so far I'm doing well. I just used some of the code from the tutorials on this site and changed them to suit my needs. Everything works except updating the database. Clicking edit swaps a row in a table with a form that should allow me to update the entry. Here is the error it throws.

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
I have followed the correct syntax as far as I can tell, but like I said, this is my first time with PHP and MySQL. Following is all my code (minus CSS which has nothing in it really) with the appropriate sections highlighted.

Code:

Syntax Error, Unexpected T_STRING
Parse error: syntax error, unexpected T_STRING in C:...

Here is the script ....

Page Last Updated Syntax Error
I tried embedding this in an XHTML file, then changed it to a
last4.php, but get a syntax error. What am I doing wrong?

<?php
$last_modified = filemtime("last4.php");
print("Page Last Updated: ");
print(date("m/j/y h:i", $last_modified));
?> ...

Last Date Updated Syntax Error
I tried embedding this in an XHTML file, then changed it to last4.php,
but get a syntax error. What am I doing wrong?

<?php
$last_modified = filemtime("last4.php");
print("Page Last Updated: ");
print(date("m/j/y h:i", $last_modified));
?>...


Copyright © 2005-08 www.BigResource.com, All rights reserved