Ответ: Parse error: syntax error, unexpected $end in A:\home\meddostavka.ru\www\log.php on line 26

Ответ: Parse error: syntax error, unexpected $end in A:\home\meddostavka.ru\www\log.php on line 26
Denwer, PHP Version 5.3.13

<?php
//просто функция
 function translit($str) {
    $rus = array('А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я');
    $lat = array('A', 'B', 'V', 'G', 'D', 'E', 'E', 'Gh', 'Z', 'I', 'Y', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'H', 'C', 'Ch', 'Sh', 'Sch', 'Y', 'Y', 'Y', 'E', 'Yu', 'Ya', 'a', 'b', 'v', 'g', 'd', 'e', 'e', 'gh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'sch', 'y', 'y', 'y', 'e', 'yu', 'ya');
    return str_replace($rus, $lat, $str);
  }
//POST запрос пароль-емайл
$email = $_POST["email"];
$password = $_POST["password"];
$link = mysql_connect("localhost", "root", "");
$db = mysql_select_db("apteka") or die("Couldn't select database.");
$result = mysql_query("SELECT password FROM users WHERE email = \"[email protected]\");
//ответ на коннект
if (!$result) {
echo 'Could not run query: ' . mysql_error();
}
$row = mysql_fetch_row($result);
if ($result) {
echo $row[0];
echo $row[1];
}
?>

Where error here?

If you look at the color highlighting, it is broken after the line with the sql query statement, indicating that is the line that likely contains the problem.

I recommend that you build any sql query statement in a php variable. Also, don’t escape double-quotes, use single-quotes. Once you make these changes should should be able to see what the problem is.

Next, the php version and the mysql_ extension are way out of date. You should plan on learning and using php8+, and use the PDO database extension.

Sponsor our Newsletter | Privacy Policy | Terms of Service