This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
I place to the php line a large piece of html code with javascript inserts (with jQuery) in which $ symbols is present.
<?php
$site = <<<SITE_CODE
setTimeout(function(){$(g_utils._f().menu.current_id).trigger('click')}, g_utils.effects.animation(g_utils._f().animation.events.loading, 'delay2'));
SITE_CODE;
echo $site;
?>
PHP takes this as a variable and produces an error.
Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$'
in D:\site\index.php on line 328
Tell me how to get rid of this problem?
If you single quote the EOL string it will not evaluate any variable:
$site =
<<<'SITE_CODE'
setTimeout(function(){$(g_utils._f().menu.current_id).trigger('click')}, g_utils.effects.animation(g_utils._f().animation.events.loading, 'delay2'));
SITE_CODE;
Related
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 1 year ago.
I'm getting error in the PHP code it's a Wordpress custom theme, it made my website down.
PHP Syntax Check:
Parse error: syntax error, unexpected '$', expecting variable (T_VARIABLE) in your code on line 1
Here is the code:
$path = "/home/u921722263/domains/fallcomlegal.co/public_html/wp-content/!function($){$.easing.jswing=$.easing.swing,$.extend($.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){return(t/94256)}";
There is a Syntax errorin this part:
{return $.easing$.easing.def},
because $.easing is followed with a $ there should be a , or something else.
Try fixing this part.
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
I got Error like this [Parse error: syntax error, unexpected 'connected' (T_STRING) in C:\xampp\htdocs\koneksi\update.php on line 5]
<?php
if($_SERVER['REQUEST_METHODE']=='POST){
include('connected.php');
$room=$_POST['NoRoom'];
$status=$_POST['RoomStatus'];
$Sql_Query="UPDATE cfg_init_room SET number='$room, status_code='$status';
if (mysqli_query($con,$SQl_Query));
{
echo 'Status Updated';
}else{
echo'Gagal Update Status';
}
}mysqli_close($con);
?>
On this line if($_SERVER['REQUEST_METHODE']=='POST){ there is a missing ' after POST.
Make that line if($_SERVER['REQUEST_METHODE']=='POST'){ and it should work.
On most IDEs you will see a shift in text color between strings and functions, just like here on SO.
That is a telling sign you forgot to close a string.
Edit: now that I look at your code more closely it seems you have another string problem.
At the end in the if else your strings are correct. They shouldn't.
So that means there is another problem with your strings, probably in $sql_query line.
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
Below is the program i have created using PHP.
foreach (.$resource->getAttributeMap()->entrySet() as .$entry);
if($entrey->getkey()->equal($Resource->RESOURCE_ID_KEY))
continue;
echo".$entry->getkey(). $entry->getValue()[0]";
The program can't iterator for each. How to the solve the issue?
The actual context of the code is not clear but it has syntax errors like .(dot) preceding the variable names, not consistent variable names etc. A modified code would be :
foreach ($resource->getAttributeMap()->entrySet() as $entry){
if($entry->getkey()->equal($resource->RESOURCE_ID_KEY)){
continue;
}
echo $entry->getkey()."". $entry->getValue()[0];
}
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
last "}" is line 762. log says "PHP Parse error: syntax error, unexpected '}' in /home/u230748479/public_html/application/controllers/api_new.php on line 762" if you need whole code ill send you. please help me. thanks.
https://drive.google.com/open?id=0B6DjyTFNtfv5SjZBM2JGNVh2V2c
link to my php file
There is nothing wrong with your code, but you got 3 invalid (\u007F) characters before the } that gives the error.
This is your code
echo "1";
}
// this line contains 3 invalid characters (\u007F = DELETE character)
} // this is line 762
Remove the line with the invalid characters and you should be good to go.
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
Whats wrong in following query???
am getting error
Parse error:
syntax error, unexpected 'INSERT' (T_STRING)
$NEW_TOKEN = mysql_query("INSERT INTO `iPhone_users` (`DEVICE_TOKEN`,`NAME`,`LOGIN_ID`,`CREATED_AT`) VALUES ('$DEVICE_TOKEN','$STUDENT_FIRST_NAME','$LOGIN_ID','$TODAY')");
You need to close either a single quote or double quote which started before the line you pasted. There is nothing wrong with the query itself.
The error you are getting is a PHP parse error.