<?php $host='localhost'; // имя хоста (уточняется у провайдера) $user='ggefesq4_mysite'; // заданное вами имя пользователя, либо определенное провайдером $pswd='www045'; // заданный вами пароль $database='ggefesq4_mysite'; // имя базы данных, которую вы должны создать $rssSQL = mysql_connect($host, $user, $pswd) or die("Не могу соединиться с MySQL."); mysql_select_db($database) or die("Не могу подключиться к базе."); $xml_file = "http://rss.medicalnewstoday.com/it-internet-e-mail.xml"; $sxml = simplexml_load_file($xml_file); foreach ($sxml->channel->item as $item){ $title = $item->title; $date= $item->pubDate; $link = $item->link; $description = $item->description; $sql = ("INSERT INTO it (id,title, pubdate, link,description) VALUES(0,'.$title.','.$date.', '.$link.','.$description.')"); $retval = mysql_query($sql); if(!$retval ) { die('Could not enter data: ' . mysql_error()); } $strtemp = "<p><a href=\"$item->link\">"."$item->title</a> <span class=\"time\" style=\"font-size:11px;color:#555;\">".date("dmY",strtotime($item->pubDate))."</span></p>\n"; echo $strtemp; } ?> 

Closed due to the fact that it was off topic by Nicolas Chabanovsky Oct 22 '16 at 11:56 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Nicolas Chabanovsky
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    You have written nonsense in the request. Your option:

     $sql = ("INSERT INTO `it` (`id`, `title`, `pubdate`, `link`, `description`) VALUES (0, $title, $date, $link, $description)"); 

    See if you write expressions in double quotes, then PHP itself will try to substitute variables. If in singles then:

     $sql = ('INSERT INTO `it` (`id`, `title`, `pubdate`, `link`, `description`) VALUES (0, '.$title.', '.$date.', '.$link.', '.$description.')'); 

    And you wrote something in between. Also, variables need not be overridden:

     $title = $item->title; $date= $item->pubDate; $link = $item->link; $description = $item->description; 

     $sql = ('INSERT INTO `it` (`id`, `title`, `pubdate`, `link`, `description`) VALUES (0, '.$item->title.', '.$item->pubDate.', '.$item->link.', '.$item->description.')');