Expecting or identifier php

Отладчик указывает на синтаксическую ошибку, а ее там нет почему?

Отладчик указывает на синтаксическую ошибку, а ее там нет почему?

Parse error: syntax error, unexpected » (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\OpenServer\domains\localhost\signup.php on line 48

 function checkUser(user) < if (user.value == '') < O('info').innerHTML = '' return >params = "user=" + user.value request = new ajaxRequest() request.open("POST", "checkuser.php", true) request.setRequestHeader("Content-type","application/x-www-form-urlencoded") request.setRequestHeader("Connection", "close") request.onreadystatechange = function() < if (this.readyState == 4) if (this.status == 200) if (this.responseText != null) O('info').innerHTML = this.responseText >request.send(params) > function ajaxRequest() < try catch(e1) < try catch(e2) try catch(e3) < request = false >> > return request > 

Please enter your details to sign up

// Введите, пожайлуста, свои регистрационные данные _END; $error = $user = $pass = ""; if (isset($_POST['user'])) destroySession(); if (isset($_POST['user'])) < $user = sanitizeString($_POST['user']); $pass = sanitizeString($_POST['pass']); if ($user == "" || $pass == "") $error = "Данные введены не во все поля

"; else < $result = queryMysql("SELECT * FROM members WHERE user='$user'"); if ($result->num_rows) $error = "Такое имя уже существует

"; else < queryMysql("INSERT INTO members VALUES('$user','$pass')"); die("

Account created

Please Log in.

"); // Учетная запись создана, // пожайлуста, войдите на сайт > > > echo $error Username
Password
_END; ?>  
?>

Она там есть.
(на самом деле она чуть выше, в строке 45)
Поставьте себе какой-нибудь редактор с подсветкой.

Внимание
Очень важно отметить, что строка с закрывающим идентификатором не должна содержать других символов, за исключением точки с запятой (;). Это означает, что идентификатор не должен вводиться с отступом и что не может быть никаких пробелов или знаков табуляции до или после точки с запятой.

P.S.: И да, если вашему учебнику лет 15, то возможно стоит поискать ему замену, пока вы не привыкли писать лапшу.

Читайте также:  Cron php www data

Если посоветуете буду очень признателен за учебник, редактор скачал ZEND Studio только он тоже самое что и браузер выдает.

sunnyrio: То есть вам редактор указывает на ошибку, но вы ему просто не верите? Ну ок.

В учебник я давно не заглядывал, хватает гугла и документации на php.net

Но можете посмотреть что рекомендовали здесь

sunnyrio: возможно стоит и редактор сменить. Или настроить нормально. Я только что проверил в sublime, notepad++, phped — все показывают что с четвертой строки начинается heredoc и нигде не заканчивается.

Войдите, чтобы написать ответ

Как прописать условие при котором блок показываться не будет?

Источник

php — Parse error: syntax error, unexpected string content «», expecting «-» or identifier or variable or number

Answer

Solution:

There is indeed a problem with the syntax of the 146th line, but that isn’t the primary problem you have here.

You should read up on this question for a better way to query mysql from inside PHP, even after fixing the syntax problem, you’re open to SQL injection, allowing any visitor to delete your entire database: How can I prevent SQL injection in PHP?

Changing the query into a prepared statement solves your syntax problem along the way.

I’m hesitant to include the quickfix for the syntax, as i DO NOT think you should use this fix and continue onwards (i really think you should follow the advice in the link above), but it is:

$insert = "UPDATE pendaftaran SET stat = " . $stat . " WHERE . $row['no']; 

Share solution ↓

Additional Information:

Didn’t find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Читайте также:  Код формы комментариев html

Similar questions

Find the answer in similar questions on our website.

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

About the technologies asked in this question

PHP

PHP (from the English Hypertext Preprocessor — hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites. The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/

MySQL

DBMS is a database management system. It is designed to change, search, add and delete information in the database. There are many DBMSs designed for similar purposes with different features. One of the most popular is MySQL. It is a software tool designed to work with relational SQL databases. It is easy to learn even for site owners who are not professional programmers or administrators. MySQL DBMS also allows you to export and import data, which is convenient when moving large amounts of information.
https://www.mysql.com/

Welcome to programmierfrage.com

programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated by the community. Together with you, we create a free library of detailed answers to any question on programming, web development, website creation and website administration.

Get answers to specific questions

Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.

Help Others Solve Their Issues

Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.

Читайте также:  Плагин для вордпресс html

Источник

Выдаёт ошибку: (T_ENCAPSED_AND_WHITESPACE), expecting ‘-‘ or identifier(T_STRING)or variable(T_VARIABLE)or number(T_N.

вот кусочек кода, который содержит строку с ошибкой, а именно:
if (isset($_COOKIE[‘login’])) //есть ли переменная с логином в COOKIE. Должна быть, если пользователь при предыдущем входе нажал на чекбокс «Запомнить меня»

// вся процедура работает на сессиях. Именно в ней хранятся данные пользователя, пока он находится на сайте. Очень важно запустить их в самом начале странички.
session_start();
include («bd.php»);// файл bd.php должен быть в той же папке, что и все остальные, если это не так, то просто измените путь
if (!empty($_SESSION[‘login’]) and! empty($_SESSION[‘password’]))
//если существует логин и пароль в сессиях, то проверяем их и извлекаем аватар

$login = $_SESSION[‘login’];
$password = $_SESSION[‘password’];
$result = mysqli_query(«SELECT id,avatar FROM users WHERE login=’$login’ AND password=’$password'»,$db);
$myrow = mysqli_fetch_array($result);

//извлекаем нужные данные о пользователе
>
?>

if (!isset($myrow[‘avatar’]) or $myrow[‘avatar’]==»)

//проверяем, не извлечены ли данные пользователя из базы. Если нет, то он не вошел, либо пароль в сессии неверный. Выводим окно для входа. Но мы не будем его выводить для вошедших, им оно уже не нужно.
print

в чем тут проблема, может кто знает? подскажите пожалуйста.

Сообщение об ошибке синтаксиса показывает не реальное место ошибки, а место, где эта ошибка была замечена парсером. Сама же ошибка допущена в одной из нескольких предшествующих строк. Так что надо смотреть на то, что находится ВЫШЕ if (isset($_COOKIE[‘login’])).

Зачем ты каждый раз перечитываешь из базы данных id и avatar? Если хранишь в сессии логин и пароль, что тебе мешает хранить там же и прочие параметры пользователя?

Вот то, что выше:

Андрей Высший разум (333295) Объясни, зачем тебе heredoc? Что изменится, если ты заменишь print а HERE; на

Источник

Оцените статью