Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

sergera0

Newbie
  
  • Posts

    2
  • Joined

  • Last visited

sergera0's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. вообщем вылезли ошибки после подключения к бд: Notice: Undefined variable: id in /home/litovkin/data/www/*.ru/texts.php on line 6 Notice: Undefined variable: where in /home/litovkin/data/www/*.ru/fnc/func.php on line 9 Notice: Undefined variable: connect in /home/litovkin/data/www/*.ru/fnc/connect.php on line 14 Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/litovkin/data/www/*.ru/fnc/connect.php on line 14 Собственно вот код на который указывают ошибки: <?php require_once "fnc/func.php"; $news = getNews(50, $id); // строка 6 где неизвестна переменная id $title = "Стихи"; require_once "blocks/head.php" ; ?> вторая ошибка в файле func.php line 9 неизвестна переменная where <?php require_once "connect.php"; function getNews($limit, $id){ global $db; connectDB(); if($id) $where = "WHERE `id` = ".$id; $result = mysql_query("Select * FROM news $where ORDER BY id DESC LIMIT $limit"); // line 9в которой ошибка closeDB(); if(!$id) return resultToArray($result); else return mysql_fetch_assoc($result); } function resultToArray($result) { $array = array(); while(($row = mysql_fetch_assoc($result)) != false) $array[] = $row; return $array; } ?> и наконец как мне кажется ключевой фаил connect.php ошибка на14 лайне и что-то там с mysql_close() <?php $db = false; function connectDB () { global $db; $connect = mysql_connect("localhost", "limit", "*****"); $select = mysql_select_db("litovkinmBASE", $connect); $db = mysql_query("SELECT * FROM news", $connect); mysql_query("SET NAMES 'utf8'"); } function closeDB () { global $db; $db = null; mysql_close($connect); // та самая 14 строка } ?> я еще новенький по этому извиняйте если тут все очень просто а я не вижу, надеюсь на вашу помощь, спасибо
Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.