Here is the script:
<?php $host='localhost'; // имя хоста (уточняется у провайдера) $database='db'; // имя базы данных, которую вы должны создать $user='user'; // заданное вами имя пользователя, либо определенное провайдером $pswd=''; // заданный вами пароль $dbh = mysql_connect($host, $user, $pswd) or die("Не могу соединиться с MySQL."); mysql_select_db($database) or die("Не могу подключиться к базе."); mysql_query("SET NAMES 'utf8'"); $query = "SELECT opisanie FROM `db` where tema='тема'"; $res = mysql_query($query); $row = mysql_fetch_row($res); echo $row[0]; ?>
Suppose we have found several results for the key "topic", in which variable is the first and second results? PS $ row [1] tried, did not help.
Strange. If you write $query = "SELECT * FROM db where tema='тема' limit 0,2";
, then the output is normal (but the information that I need is not displayed), if you write $query = "SELECT opisanie FROM db where tema='тема' limit 0,2";
, then an error occurs: Notice: Undefined offset: 1 in ...