{"id":135308,"date":"2026-07-21T08:31:37","date_gmt":"2026-07-21T02:31:37","guid":{"rendered":"https:\/\/rcl-radio.ru\/?p=135308"},"modified":"2026-07-21T08:31:37","modified_gmt":"2026-07-21T02:31:37","slug":"%d0%bf%d0%b5%d1%80%d0%b2%d1%8b%d0%b9-%d0%b7%d0%b0%d0%bf%d1%80%d0%be%d1%81-%d0%ba-mysql-%d0%b8%d0%b7-php-%d0%b1%d1%83%d0%ba%d0%b2%d0%b0%d0%bb%d1%8c%d0%bd%d0%be-10-%d1%81%d1%82%d1%80%d0%be%d0%ba","status":"publish","type":"post","link":"https:\/\/rcl-radio.ru\/?p=135308","title":{"rendered":"\u041f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a MySQL \u0438\u0437 PHP: \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e 10\u00a0\u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430"},"content":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0438 \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443. \u0411\u0435\u0437 \u0442\u0435\u043e\u0440\u0438\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043d\u0430 PDO (\u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442, \u0441\u0442\u0430\u0440\u044b\u0435 mysql_* \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c).<\/p>\n<hr \/>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 1: \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 (10 \u0441\u0442\u0440\u043e\u043a)<\/h2>\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: #000000; font-weight: bold;\">&lt;?php<\/span>\r\n<span style=\"color: #000088;\">$dsn<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'mysql:host=localhost;dbname=testdb;charset=utf8mb4'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$user<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'db_user'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$pass<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'db_pass'<\/span><span style=\"color: #339933;\">;<\/span>\r\n\u00a0\r\n<span style=\"color: #000088;\">$pdo<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000000; font-weight: bold;\">new<\/span> PDO<span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$dsn<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$user<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$pass<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #009900;\">[<\/span>\r\n    PDO<span style=\"color: #339933;\">::<\/span><span style=\"color: #004000;\">ATTR_ERRMODE<\/span> <span style=\"color: #339933;\">=&gt;<\/span> PDO<span style=\"color: #339933;\">::<\/span><span style=\"color: #004000;\">ERRMODE_EXCEPTION<\/span>\r\n<span style=\"color: #009900;\">]<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n\u00a0\r\n<span style=\"color: #000088;\">$stmt<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000088;\">$pdo<\/span><span style=\"color: #339933;\">-&gt;<\/span><span style=\"color: #004000;\">query<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">'SELECT id, name FROM users LIMIT 1'<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$row<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000088;\">$stmt<\/span><span style=\"color: #339933;\">-&gt;<\/span><span style=\"color: #004000;\">fetch<\/span><span style=\"color: #009900;\">(<\/span>PDO<span style=\"color: #339933;\">::<\/span><span style=\"color: #004000;\">FETCH_ASSOC<\/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: #000088;\">$row<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">echo<\/span> <span style=\"color: #0000ff;\">'ID: '<\/span> <span style=\"color: #339933;\">.<\/span> <span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'id'<\/span><span style=\"color: #009900;\">]<\/span> <span style=\"color: #339933;\">.<\/span> <span style=\"color: #0000ff;\">', \u0418\u043c\u044f: '<\/span> <span style=\"color: #339933;\">.<\/span> <span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'name'<\/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>\u0427\u0442\u043e \u0442\u0443\u0442 \u0435\u0441\u0442\u044c:<\/p>\n<ul>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">$dsn<\/code>\u00a0\u2014\u00a0\u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (\u0445\u043e\u0441\u0442, \u0431\u0430\u0437\u0430, \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430).<\/li>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">PDO<\/code>\u00a0\u2014\u00a0\u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/li>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">query()<\/code>\u00a0\u2014\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u0434\u043b\u044f <code class=\"CodeInlined\">SELECT<\/code> \u0431\u0435\u0437 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e).<\/li>\n<li data-value=\"\" data-shift=\"0\"><code class=\"CodeInlined\">fetch()<\/code>\u00a0\u2014\u00a0\u0431\u0435\u0440\u0451\u0442 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u0430\u043a \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432.<\/li>\n<li data-value=\"\" data-shift=\"0\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <code class=\"CodeInlined\">if ($row)<\/code>\u00a0\u2014\u00a0\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/li>\n<\/ul>\n<hr \/>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 2: \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e ID)<\/h2>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u00ab\u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432\u00bb, \u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c\u00a0\u2014\u00a0\u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0431\u0443\u0434\u0435\u0448\u044c \u0431\u0440\u0430\u0442\u044c ID \u0438\u0437 <code class=\"CodeInlined\">$_GET<\/code> \u0438\u043b\u0438 <code class=\"CodeInlined\">$_POST<\/code>.<\/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: #000000; font-weight: bold;\">&lt;?php<\/span>\r\n<span style=\"color: #000088;\">$dsn<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'mysql:host=localhost;dbname=testdb;charset=utf8mb4'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$user<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'db_user'<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$pass<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">'db_pass'<\/span><span style=\"color: #339933;\">;<\/span>\r\n\u00a0\r\n<span style=\"color: #000088;\">$pdo<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000000; font-weight: bold;\">new<\/span> PDO<span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$dsn<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$user<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$pass<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #009900;\">[<\/span>\r\n    PDO<span style=\"color: #339933;\">::<\/span><span style=\"color: #004000;\">ATTR_ERRMODE<\/span> <span style=\"color: #339933;\">=&gt;<\/span> PDO<span style=\"color: #339933;\">::<\/span><span style=\"color: #004000;\">ERRMODE_EXCEPTION<\/span>\r\n<span style=\"color: #009900;\">]<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n\u00a0\r\n<span style=\"color: #000088;\">$id<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #cc66cc;\">5<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/ \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c (int)$_GET['id']<\/span>\r\n<span style=\"color: #000088;\">$stmt<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000088;\">$pdo<\/span><span style=\"color: #339933;\">-&gt;<\/span><span style=\"color: #004000;\">prepare<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">'SELECT id, name FROM users WHERE id = ?'<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$stmt<\/span><span style=\"color: #339933;\">-&gt;<\/span><span style=\"color: #004000;\">execute<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #000088;\">$id<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\r\n<span style=\"color: #000088;\">$row<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000088;\">$stmt<\/span><span style=\"color: #339933;\">-&gt;<\/span><span style=\"color: #004000;\">fetch<\/span><span style=\"color: #009900;\">(<\/span>PDO<span style=\"color: #339933;\">::<\/span><span style=\"color: #004000;\">FETCH_ASSOC<\/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: #000088;\">$row<\/span><span style=\"color: #009900;\">)<\/span> <span style=\"color: #009900;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">echo<\/span> <span style=\"color: #0000ff;\">'ID: '<\/span> <span style=\"color: #339933;\">.<\/span> <span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'id'<\/span><span style=\"color: #009900;\">]<\/span> <span style=\"color: #339933;\">.<\/span> <span style=\"color: #0000ff;\">', \u0418\u043c\u044f: '<\/span> <span style=\"color: #339933;\">.<\/span> <span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'name'<\/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 \u0432\u043c\u0435\u0441\u0442\u043e <code class=\"CodeInlined\">query()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code class=\"CodeInlined\">prepare()<\/code> + <code class=\"CodeInlined\">execute()<\/code>\u00a0\u2014\u00a0\u044d\u0442\u043e \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 SQL\u2011\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0448\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439.<\/p>\n<hr \/>\n<h2>\u0412\u0430\u0436\u043d\u044b\u0435 \u043c\u0435\u043b\u043e\u0447\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0430\u0434\u0430\u043b\u043e<\/h2>\n<ol>\n<li data-value=\"1.\" data-shift=\"1\"><strong>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 <code class=\"CodeInlined\">utf8mb4<\/code> \u0432 DSN.<\/strong> \u0415\u0441\u043b\u0438 \u0435\u0451 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0435\u0439 \u0438 \u044d\u043c\u043e\u0434\u0437\u0438.<\/li>\n<li data-value=\"2.\" data-shift=\"1\"><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a.<\/strong> \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043b\u043e\u0432\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code class=\"CodeInlined\">try\/catch<\/code>, \u0430 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/li>\n<li data-value=\"3.\" data-shift=\"1\"><strong>\u041f\u0430\u0440\u043e\u043b\u044c \u043d\u0435 \u0432 \u043a\u043e\u0434\u0435.<\/strong> \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043f\u0440\u044f\u043c\u043e \u0432 \u0444\u0430\u0439\u043b\u0435\u00a0\u2014\u00a0\u0442\u0430\u043a \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u043d\u0435\u043b\u044c\u0437\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u2011\u0444\u0430\u0439\u043b \u0432\u043d\u0435 \u0432\u0435\u0431\u2011\u043a\u043e\u0440\u043d\u044f.<\/li>\n<li data-value=\"4.\" data-shift=\"1\"><strong>\u041f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0411\u0414.<\/strong> \u0423 <code class=\"CodeInlined\">db_user<\/code> \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 <code class=\"CodeInlined\">SELECT<\/code> \u0438\u0437 \u043d\u0443\u0436\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/li>\n<\/ol>\n<hr \/>\n<h2>\u041a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439 \u0444\u0430\u0439\u043b <code class=\"CodeInlined\">test.php<\/code> \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u044b\u0448\u0435, \u043f\u043e\u043b\u043e\u0436\u0438 \u0432 \u043f\u0430\u043f\u043a\u0443, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431\u2011\u0441\u0435\u0440\u0432\u0435\u0440, \u0438 \u043e\u0442\u043a\u0440\u043e\u0439 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0438\u0448\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432\u0438\u0434\u0430:<\/p>\n<blockquote class=\"FuturisMarkdown-BlockQuote\"><p>ID: 5, \u0418\u043c\u044f: \u0418\u0432\u0430\u043d<\/p><\/blockquote>\n<p>\u2014 \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u0415\u0441\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0443\u0441\u0442\u0430\u044f \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u00a0\u2014\u00a0\u0441\u043c\u043e\u0442\u0440\u0438 \u043b\u043e\u0433\u0438 PHP \u0438 \u0443\u0431\u0435\u0434\u0438\u0441\u044c, \u0447\u0442\u043e:<\/p>\n<ul>\n<li data-value=\"\" data-shift=\"0\">\u0441\u0435\u0440\u0432\u0435\u0440 \u0411\u0414 \u0437\u0430\u043f\u0443\u0449\u0435\u043d,<\/li>\n<li data-value=\"\" data-shift=\"0\">\u0445\u043e\u0441\u0442\/\u0438\u043c\u044f \u0431\u0430\u0437\u044b\/\u043b\u043e\u0433\u0438\u043d\/\u043f\u0430\u0440\u043e\u043b\u044c \u0432\u0435\u0440\u043d\u044b\u0435,<\/li>\n<li data-value=\"\" data-shift=\"0\">\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 \u0432 DSN \u0443\u043a\u0430\u0437\u0430\u043d\u0430.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0438 \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443. \u0411\u0435\u0437 \u0442\u0435\u043e\u0440\u0438\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043d\u0430 PDO (\u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442, \u0441\u0442\u0430\u0440\u044b\u0435 mysql_* \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c). \u0412\u0430\u0440\u0438\u0430\u043d\u0442 1: \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 (10 \u0441\u0442\u0440\u043e\u043a) php &lt;?php $dsn = &#8216;mysql:host=localhost;dbname=testdb;charset=utf8mb4&#8217;; $user = &#8216;db_user&#8217;; $pass = &#8216;db_pass&#8217;; \u00a0 $pdo = new PDO($dsn, $user, $pass, [ PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION ]); \u00a0 [&hellip;]<\/p>\n","protected":false},"author":9194254,"featured_media":135301,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[],"class_list":["post-135308","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"views":8,"_links":{"self":[{"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/135308","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=135308"}],"version-history":[{"count":1,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/135308\/revisions"}],"predecessor-version":[{"id":135309,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/135308\/revisions\/135309"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/135301"}],"wp:attachment":[{"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}