Parse error: syntax error, unexpected = on line 30 как исправить?

0
<?php

	function insert($name, $desk, $year, $rating, $poster, $category_id) {
		$mysqli = new mysqli('localhost', 'root', '', 'kinomonster');

		if(mysqli_connect_errno()) {
			printf('Соединение не установлено');
			exit();
		}

		$mysqli->set_charset('utf8');
		$quary = "INSERT INTO movie VALUES(null, '$name', '$desk', '$year', '$rating', '$poster', Now(), '$category_id')";
		$result = false;
		if($mysqli->quary($quary)) {
			$result = true;
		}

		return $result;
	}

	


	
	$xml = simplexml_load_file("xml/movies.xml") or die("Error: Cannot create object");

	//echo count($xml);

	$title = null;
	$title-orign = null;
	$post = null;
	$rating = null;
	$year = null;


	foreach ($xml as $movie_key => $movie) {
		$title = $movie->title-russian;
		$title-orign = $movie->title-original;
		$year = $movie->year;


		foreach ($movie->poster->big->attributes() as $poster_key => $value) {
			$post = $poster;
		}

		if($movie->imdb) {
			$rating = $movie->imdb->attributes()['rating'];
		} else {
			$rating = null;
		}

		insert($title, $title-orign, $year, $rating, $post, 1);


	}

	echo "<pre>";
	print_r($xml);
	echo "</pre>";

?>






php

2 ответов

0

Все слова в коде, которые выделены темным цветом - это ошибка. Переменные не задаются через тире: $title-orign. Можно так: $title_orign или так: $titleOrign

0

Спасибо. Как я не увидел!

Sign up or Log in to write an answer