Parse error: syntax error, unexpected 'Y' (T_STRING) [duplicate] - php

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
this is my first queston i ask, its about this code:
<?php
date_default_timezone_set('America/Santiago);
$fecha=date('Y-m-d');
$hora=date('H:i:s');
$link=mysqli_connect('localhost','root','','evaluacion2');
$sql="INSERT INTO sensores SET temperatura=".$_GET['celsius'].",distancia=".
$_GET['distancia'].",fecha='".$fecha."',hora='".$hora."'";
mysqli_query($link,$sql);
?>
i try to insert from the URL
http://localhost/sensores/capturadatos.php?temperatura=3&distancia=12
but i get this message
Parse error: syntax error, unexpected 'Y' (T_STRING) in D:\wamp64\www\sensores\capturadatos.php on line 3

Replace date_default_timezone_set('America/Santiago);
to date_default_timezone_set('America/Santiago');

Related

I'm new to php I'm getting this error "PHP Parse error: syntax error, unexpected '$sum' (T_VARIABLE)" [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed last year.
This is the code
<?php
$sum=1+1;
$sub=1-1;
$div=1/1;
$mult=1*1;
printf("SUM:%d\nSUB:%d\nDIV:%d\nMULTI:%d\n",$sum,$sub,$div,$mult);
?>
ERROR:
PHP Parse error: syntax error, unexpected '$sum' (T_VARIABLE) in /var/labsstorage/home/Jaswanth/files/test.php on line 40
Try this:
echo "SUM:".$sum."SUB:".$sub."DIV:".$div."MULTI:".$mult;

Parse error: syntax error, unexpected 'ndxzsite' (T_STRING), expecting ',' or ')' [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
I am a beginner in php. Can someone please help me with this error!
Can not find the problem...
Parse error: syntax error, unexpected 'ndxzsite' (T_STRING), expecting ',' or ')' in /customers/0/6/5/nadianena.com/httpd.www/index.php on line 10
So in looked in my editor KOMODO and it indeed says there is a parse error in this line:
if (file_exists('ndxzsite/config/config.php')) require_once 'ndxzsite/config/config.php';

PHP Parse error: syntax error, unexpected 'preg_match' (T_STRINGd [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
When i try to run this script :
include('db.php');
$site=file_get_contents("https://example.com");
$baslik='#<title>(.*?)</title>#si';
$içerik='#<div class="post-content">(.*?)</div>#si';
$kategori='#<p class="post-categories"><span>Kategoriler:(.*?)</a></p>#si';
preg_match($baslik,$site,$baslikfonksiyon);
preg_match($icerik,$site,$icerikfonksiyon);
preg_match($kategori,$site,$kategorifonksiyon);
$baslikkullan=$baslikfonksiyon[1];
$icerikkullan=$icerikfonksiyon[1];
$kategorikullan=$kategorifonksiyon[1];
i see this error in error_log file :
[01-Mar-2017 20:39:41 UTC] PHP Parse error: syntax error, unexpected
'preg_match' (T_STRING) in /example/file/path on line 9
Can anyone explain to me why i get this error
Thanks.
I think you have problem with the regex. Try with:
$baslik = '^.*?<\/title>';

Php SQL syntax error [duplicate]

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.

Parse error: syntax error, unexpected ''aws_account.aws_account_id'' (T_CONSTANT_ENCAPSED_STRING) in project [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
I came across the following error, but I fail to see what is wrong:
Parse error: syntax error, unexpected ''aws_account.aws_account_id'' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\laravel\awsconfig\app\controllers\CRUDController.php on line 11
my join statement where the error is being thrown:
$query = DB::table('ec2_instance')->join('aws_account', 'aws_account.id', '=', 'ec2_instance.id')->select('ec2_instance.instance_id', 'ec2_instance.public_dns_name', 'ec2_instance.key_name','ec2_instance.instance_type','ec2_instance.launch_time',‌​'aws_account.aws_account_id')->get();
You've got some junk characters there between the last , and ':

Categories