<!doctype html><html><head><metacharset="utf-8"><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><?php try{ $pdo =new PDO("mysql:host=mysql87.1gb.ru; dbname=gb_tw_mag","xxx","xxx"); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);}catch(PDOException $e){ echo "<p>Запрос на выборку данных из бызы не прошёл. Напишите об этом администратору <a href='mailto:admin@torawhite.ru'>admin@torawhite.ru</a>.</p><br>ERROR: ". $e->getMessage();exit;} $data = $pdo->prepare("SELECT link, title, article_img, description, article_date, author, author_link FROM male_article WHERE cat='1'"); $data->execute(array('cat'=>1)); $row = $data->fetch();?><metaname="description"content=""><metaname="keywords"content=""><title>Стиль | Журнал | Torawhite.ru | Store & Magazine</title><?php include ("http://www.torawhite.ru/blocks/favicon.php");?><!--Таблицы стилей--><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/reset.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/input_reset.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/main.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/fonts.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/header.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/magazine/magazine_css/magazine_left_sidebar.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/magazine/magazine_css/article_block_box.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/magazine/article/article_block.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/magazine/magazine_css/magazine_right_sidebar.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/top_nav.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/bottom_nav.css"><linkrel="stylesheet"type="text/css"href="http://www.torawhite.ru/css/footer.css"><?php include ("http://www.torawhite.ru/magazine//magazine_blocks/magazine_scripts_head.php");?></head><body><divclass="wrapper"><?php include ("http://www.torawhite.ru/blocks/header.php"); include ("http://www.torawhite.ru/blocks/top_nav.php");?><divclass="container"><?php include ("http://www.torawhite.ru/magazine/magazine_blocks/magazine_left_sidebar.php");?><divclass='article_block_box'><?php do{ printf(" <div class='article_block'> <div class='article_block_image'><a href='%s' target='_self' title='%s'></a></div> <div class='article_block_name'> <p><span class='article_block_name_top'><a href='%s' target='_self'>%s</a></span></p> <p ><span class='article_block_name_date'>%s | </span><span class='article_block_author'><a href='%s' target='_self'>%s</a></span></p> </div> <div class='article_block_text'> %s </div> <div class='article_block_full_story'> <a href='%s' target='_self'>Читать полностью</a> </div> </div>", $row["article_img"],$row["title"],$row["link"],$row["title"],$row["article_date"],$row["author_link"],$row["author"],$row["description"],$row["link"]);}while($row = $data->fetch());?></div><?php include ("http://www.torawhite.ru/magazine/magazine_blocks/magazine_right_sidebar.php");?><divclass="clear"></div></div><?php include ("http://www.torawhite.ru/blocks/bottom_nav.php"); include ("http://www.torawhite.ru/blocks/footer.php");?></div><?php include ("http://www.torawhite.ru/blocks/scripts_body.php");?></body></html>
В таком виде всё работает, но, если часть кода (где идёт соединение с базой данных):
try{ $pdo =new PDO("mysql:host=mysql87.1gb.ru; dbname=gb_tw_mag","xxx","xxx"); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);}catch(PDOException $e){ echo "<p>Запрос на выборку данных из бызы не прошёл. Напишите об этом администратору <a href='mailto:admin@torawhite.ru'>admin@torawhite.ru</a>.</p><br>ERROR: ". $e->getMessage();exit;}
Убрать в отдельный блок и подключать через include,
<?php include ("http://www.torawhite.ru/blocks/gb_tw_mag.php"); $data = $pdo->prepare("SELECT link, title, article_img, description, article_date, author, author_link FROM male_article WHERE cat='1'"); $data->execute(array('cat'=>1)); $row = $data->fetch();?>
то выдаёт ошибку в строке:
$data = $pdo->prepare("SELECT link, title, article_img, description, article_date, author, author_link FROM male_article WHERE cat='1'");
Ошибка: Fatal error: Call to a member function prepare() on a non-object in /home/virtwww/w_torawhite-ru_404794df/http/magazine/male_articles/style/index.php on line 8
Почему так, Ведь вставляется тот же текст. В блоке <?php ?> прописываю
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Здравствуйте, подскажите какой тег использовать для увеличения значения, пример на картинке.
Вроде, про такой тег я слышала. Если есть тег прогресс бар, значит и такое должно быть.
Question
Torawhite
Здравствуйте! Имеется такая страница:
В таком виде всё работает, но, если часть кода (где идёт соединение с базой данных):
Убрать в отдельный блок и подключать через include,
то выдаёт ошибку в строке:
Ошибка: Fatal error: Call to a member function prepare() on a non-object in /home/virtwww/w_torawhite-ru_404794df/http/magazine/male_articles/style/index.php on line 8
Почему так, Ведь вставляется тот же текст. В блоке <?php ?> прописываю
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.