{"id":135547,"date":"2026-08-09T18:03:58","date_gmt":"2026-08-09T12:03:58","guid":{"rendered":"https:\/\/rcl-radio.ru\/?p=135547"},"modified":"2026-08-09T18:03:58","modified_gmt":"2026-08-09T12:03:58","slug":"%d0%bf%d0%be%d0%b4%d0%ba%d0%bb%d1%8e%d1%87%d0%b5%d0%bd%d0%b8%d0%b5-%d0%ba-%d0%b1%d0%b0%d0%b7%d0%b5-%d0%b4%d0%b0%d0%bd%d0%bd%d1%8b%d1%85-%d0%b2-php","status":"publish","type":"post","link":"https:\/\/rcl-radio.ru\/?p=135547","title":{"rendered":"\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 PHP"},"content":{"rendered":"<pre class=\"php\" style=\"font-family: monospace; font-size: 14px;\"><span style=\"color: #000000; font-weight: bold;\">&lt;?php<\/span>\r\n<span style=\"color: #000088;\">$host<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'localhost'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$user<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'root'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$password<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'\u0445\u0445\u0445\u0445\u0445\u0445\u0445\u0445'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$db<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'website'<\/span><span style=\"color: #339933;\">;<\/span>\r\n\u00a0\r\n<span style=\"color: #000088;\">$connection<\/span> <span style=\"color: #339933;\">=<\/span> <a href=\"http:\/\/www.php.net\/mysqli_connect\"><span style=\"color: #990000;\">mysqli_connect<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$host<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$user<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$password<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$db<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n\u00a0\r\n<span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">(<\/span><span style=\"color: #339933;\">!<\/span><span style=\"color: #000088;\">$connection<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">throw<\/span> <span style=\"color: #000000; font-weight: bold;\">new<\/span> Exception<span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">'\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414: '<\/span> <span style=\"color: #339933;\">.<\/span> <a href=\"http:\/\/www.php.net\/mysqli_connect_error\"><span style=\"color: #990000;\">mysqli_connect_error<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #009900;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">(<\/span><span style=\"color: #339933;\">!<\/span><a href=\"http:\/\/www.php.net\/mysqli_set_charset\"><span style=\"color: #990000;\">mysqli_set_charset<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$connection<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000ff;\">'utf8mb4'<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">throw<\/span> <span style=\"color: #000000; font-weight: bold;\">new<\/span> Exception<span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">'\u041e\u0448\u0438\u0431\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438: '<\/span> <span style=\"color: #339933;\">.<\/span> <a href=\"http:\/\/www.php.net\/mysqli_error\"><span style=\"color: #990000;\">mysqli_error<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$connection<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #009900;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #666666; font-style: italic;\">\/\/ $connection \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435<\/span>\r\n<span style=\"color: #000000; font-weight: bold;\">?&gt;<\/span><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430\u00a0\u2014\u00a0\u0431\u0430\u0437\u043e\u0432\u044b\u0439, \u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a MySQL \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <code class=\"CodeInlined\">mysqli<\/code>. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code class=\"CodeInlined\">db_connect.php<\/code>) \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 <code class=\"CodeInlined\">require<\/code> \u0438\u043b\u0438 <code class=\"CodeInlined\">include<\/code>.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432<\/h3>\n<div class=\"CodeBlock CodeBlock_overflow_visible CodeBlock_highlight\">\n<div class=\"CodeBlock-StickyWrapper\">\n<div class=\"CodeBlock-Header\">\n<div class=\"CodeBlock-HeaderTitle\">php<\/div>\n<pre class=\"php\" style=\"font-family: monospace; font-size: 14px;\"><span style=\"color: #000088;\">$host<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'localhost'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$user<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'root'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$password<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'\u0445\u0445\u0445\u0445\u0445\u0445\u0445'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$db<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'website'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<ul>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">$host<\/code> \u2014 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044d\u0442\u043e \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e <code class=\"CodeInlined\">localhost<\/code>. \u041d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442 \u0432\u0440\u043e\u0434\u0435 <code class=\"CodeInlined\">mysql.example.com<\/code>.<\/li>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">$user<\/code> \u0438 <code class=\"CodeInlined\">$password<\/code> \u2014 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0411\u0414. \u0423 \u0442\u0435\u0431\u044f \u0437\u0434\u0435\u0441\u044c <code class=\"CodeInlined\">root<\/code> \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c\u00a0\u2014\u00a0\u044d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b, \u043d\u043e \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u043e\u0438\u0442: \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438.<\/li>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">$db<\/code> \u2014 \u0438\u043c\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f (<code class=\"CodeInlined\">website<\/code>).<\/li>\n<\/ul>\n<hr \/>\n<h3>\u0421\u0430\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<div class=\"CodeBlock CodeBlock_overflow_visible CodeBlock_highlight\">\n<div class=\"CodeBlock-StickyWrapper\">\n<div class=\"CodeBlock-Header\">\n<div class=\"CodeBlock-HeaderTitle\">php<\/div>\n<pre class=\"php\" style=\"font-family: monospace; font-size: 14px;\"><span style=\"color: #000088;\">$connection<\/span> <span style=\"color: #339933;\">=<\/span> <a href=\"http:\/\/www.php.net\/mysqli_connect\"><span style=\"color: #990000;\">mysqli_connect<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$host<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$user<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$password<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$db<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code class=\"CodeInlined\">mysqli_connect<\/code> \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code class=\"CodeInlined\">$connection<\/code> \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442\u00a0\u2014\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <code class=\"CodeInlined\">false<\/code>.<\/p>\n<hr \/>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h3>\n<div class=\"CodeBlock CodeBlock_overflow_visible CodeBlock_highlight\">\n<div class=\"CodeBlock-StickyWrapper\">\n<div class=\"CodeBlock-Header\">\n<div class=\"CodeBlock-HeaderTitle\">php<\/div>\n<pre class=\"php\" style=\"font-family: monospace; font-size: 14px;\"><span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">(<\/span><span style=\"color: #339933;\">!<\/span><span style=\"color: #000088;\">$connection<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">throw<\/span> <span style=\"color: #000000; font-weight: bold;\">new<\/span> Exception<span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">'\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414: '<\/span> <span style=\"color: #339933;\">.<\/span> <a href=\"http:\/\/www.php.net\/mysqli_connect_error\"><span style=\"color: #990000;\">mysqli_connect_error<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #009900;\">}<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c, <code class=\"CodeInlined\">mysqli_connect_error()<\/code> \u0432\u0435\u0440\u043d\u0451\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 MySQL (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00abAccess denied\u00bb \u0438\u043b\u0438 \u00abUnknown database\u00bb). \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443, \u0430 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 (<code class=\"CodeInlined\">throw new Exception<\/code>). \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0442\u0435\u0431\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u043b\u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u0432\u043c\u0435\u0441\u0442\u043e \u00ab\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0443\u043f\u0430\u043b\u0430\u00bb \u0442\u044b \u043c\u043e\u0436\u0435\u0448\u044c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0435\u0439\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<blockquote class=\"FuturisMarkdown-BlockQuote\"><p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0438\u0448\u0443\u0442 <code class=\"CodeInlined\">die(...)<\/code>, \u043d\u043e \u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043b\u0443\u0447\u0448\u0435: \u043e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0431\u043e\u0435\u0432.<\/p><\/blockquote>\n<hr \/>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438<\/h3>\n<div class=\"CodeBlock CodeBlock_overflow_visible CodeBlock_highlight\">\n<div class=\"CodeBlock-StickyWrapper\">\n<div class=\"CodeBlock-Header\">\n<div class=\"CodeBlock-HeaderTitle\">php<\/div>\n<pre class=\"php\" style=\"font-family: monospace; font-size: 14px;\"><span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #009900;\">(<\/span><span style=\"color: #339933;\">!<\/span><a href=\"http:\/\/www.php.net\/mysqli_set_charset\"><span style=\"color: #990000;\">mysqli_set_charset<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$connection<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000ff;\">'utf8mb4'<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">throw<\/span> <span style=\"color: #000000; font-weight: bold;\">new<\/span> Exception<span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">'\u041e\u0448\u0438\u0431\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438: '<\/span> <span style=\"color: #339933;\">.<\/span> <a href=\"http:\/\/www.php.net\/mysqli_error\"><span style=\"color: #990000;\">mysqli_error<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$connection<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #009900;\">}<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0417\u0434\u0435\u0441\u044c \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u00a0\u2014\u00a0\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e <code class=\"CodeInlined\">utf8mb4<\/code>. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e:<\/p>\n<ul>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">utf8<\/code> \u0432 MySQL\u00a0\u2014\u00a0\u044d\u0442\u043e \u00ab\u0443\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0439\u00bb \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u044d\u043c\u043e\u0434\u0437\u0438 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0434\u043a\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b.<\/li>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">utf8mb4<\/code>\u00a0\u2014\u00a0\u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0430\u044f UTF\u20118, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0451.<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0435 \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u00ab\u043a\u0440\u0430\u043a\u043e\u0437\u044f\u0431\u0440\u044b\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0443\u0441\u0441\u043a\u0438\u0445 \u0431\u0443\u043a\u0432 \u0438\u043b\u0438 \u044d\u043c\u043e\u0434\u0437\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 <code class=\"CodeInlined\">if<\/code> \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0435\u0451 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u0442.<\/p>\n<hr \/>\n<h3>\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445<\/h3>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0442\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 <code class=\"CodeInlined\">db_connect.php<\/code>. \u0422\u043e\u0433\u0434\u0430 \u0432 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<div class=\"CodeBlock CodeBlock_overflow_visible CodeBlock_highlight\">\n<div class=\"CodeBlock-StickyWrapper\">\n<div class=\"CodeBlock-Header\">\n<div class=\"CodeBlock-HeaderTitle\">php<\/div>\n<pre class=\"php\" style=\"font-family: monospace; font-size: 14px;\"><span style=\"color: #b1b100;\">require<\/span> <span style=\"color: #0000ff;\">'db_connect.php'<\/span><span style=\"color: #339933;\">;<\/span>\r\n\u00a0\r\n<span style=\"color: #000088;\">$result<\/span> <span style=\"color: #339933;\">=<\/span> <a href=\"http:\/\/www.php.net\/mysqli_query\"><span style=\"color: #990000;\">mysqli_query<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$connection<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #0000ff;\">\"SELECT * FROM pages WHERE is_published = 1\"<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #b1b100;\">while<\/span> <span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$row<\/span> <span style=\"color: #339933;\">=<\/span> <a href=\"http:\/\/www.php.net\/mysqli_fetch_assoc\"><span style=\"color: #990000;\">mysqli_fetch_assoc<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$result<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">echo<\/span> <a href=\"http:\/\/www.php.net\/htmlspecialchars\"><span style=\"color: #990000;\">htmlspecialchars<\/span><\/a><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'title'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #339933;\">.<\/span> <span style=\"color: #0000ff;\">'&lt;br&gt;'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #009900;\">}<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code class=\"CodeInlined\">$connection<\/code> \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php $host = &#8216;localhost&#8217;; $user = &#8216;root&#8217;; $password = &#8216;\u0445\u0445\u0445\u0445\u0445\u0445\u0445\u0445&#8217;; $db = &#8216;website&#8217;; \u00a0 $connection = mysqli_connect($host, $user, $password, $db); \u00a0 if (!$connection) { throw new Exception(&#8216;\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414: &#8216; . mysqli_connect_error()); } \u00a0 if (!mysqli_set_charset($connection, &#8216;utf8mb4&#8217;)) { throw new Exception(&#8216;\u041e\u0448\u0438\u0431\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438: &#8216; . mysqli_error($connection)); } \u00a0 \/\/ $connection \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 [&hellip;]<\/p>\n","protected":false},"author":9194254,"featured_media":135473,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[557],"tags":[],"class_list":["post-135547","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-557"],"views":7,"_links":{"self":[{"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/135547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/users\/9194254"}],"replies":[{"embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=135547"}],"version-history":[{"count":1,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/135547\/revisions"}],"predecessor-version":[{"id":135548,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/135547\/revisions\/135548"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/135473"}],"wp:attachment":[{"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}