Здравейте след като добавя категория в базата данни ми излиза на кирилица но като реша да редактирам ми излизат само въпросителни а не това което съм написал ето го и кода:
Function.php
<?php
error_reporting(E_ALL ^ E_NOTICE);
function my_header($title)
{
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="bg" xml:lang="bg">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/top_menu.css">
<style type="text/css">
div.c2 {text-align: center}
div.c1 {height: 25px; text-align: center; width: auto}
</style>
</head>
<body>
<div id="top_menu" class="c1">
<?php
if ($_SESSION['is_logged'] === true)
{
echo 'Здравей : <b>' .$_SESSION['user_info']['login'].'</b> | <a href="logout.php">Изход</a> | ';
if($_SESSION['user_info']['type']==3)
{
echo '<a href="admin/index.php">Админ панел</a>';
}
}
else
{
echo '<a href="register.php">Регистрирай се</a> | <a href="login.php">Влез</a>';
}
?>
</div>
<?php
}
function my_admin($title)
{
session_start();
if ($_SESSION['is_logged'] !== true || $_SESSION['user_info']['type']!=3)
{
header('Location: ../index.php');
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="bg" xml:lang="bg">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<link rel="stylesheet" type="text/css" href="../css/top_menu.css" />
</head>
<body>
<div id="top_menu" align="center" style="width: 45%; height: 25px;">
<a href="../index.php">Към сайта</a> | <a href="index.php">Начало админ панел</a>
</div>
<?php
}
function footer() {
echo '</body></html>';
}
function db_init()
{
mysql_connect('localhost', 'root', 'adminvrc22') or die ("Няма връзка с базата данни");
mysql_select_db('real_story') or die ('Не намерена база данни');
}
function run_q($sql)
{
mysql_query("SET NAMES utf8");
return mysql_query($sql);
}
?>
Group_story.php
<?php
include '../functions.php';
session_start();
my_admin('Групи');
db_init();
if ($_POST['group_add'] == 1) {
$name = addslashes(trim($_POST['group_name']));
$desc = addslashes(trim($_POST['desc']));
if (strlen($name) > 2) {
$id = (int) $_POST['edit_id'];
$result = mysql_query('SELECT * FROM group_story WHERE name="' . $name . '" AND group_story_id!=' . $id);
if (!mysql_num_rows($result) > 0) {
if ($id > 0) {
mysql_query('UPDATE group_story SET name="' . $name . '",`desc`="' . $desc . '" WHERE group_story_id=' . $id);
echo '<h1>Успешено обновяване</h1>';
} else {
run_q('INSERT INTO group_story (name,date_added,`desc`) VALUES ("' . $name . '",' . time() . ',"' . $desc . '")');
echo '<h1>Успешен запис</h1>';
}
} else {
echo '<h1>Името съществува</h1>';
}
} else {
echo '<h1>Името е прекалено кратко</h2>';
}
}
?>
<div id="adm_conteiner">
<div id="adm_left_menu" align="left">
<a href="group_story.php">Категорий</a><br />
<a href="story.php">Историй</a>
</div>
<div class="edit_group_story">
<center>
<b>Налични групи</b><br /><hr style="size: auto; color: #000000"/><br />
<?php
$rs = mysql_query('SELECT * FROM group_story');
echo '<table border="3" style="white-space: nowrap;"><tr><td>Име</td><td>Описание</td><td>Редактирай</td></tr>';
while ($row = mysql_fetch_assoc($rs)) {
echo '<tr><td>' . $row['name'] . '</td><td>' . $row['desc'] . '</td>
<td><a href="group_story.php?mode=edit&id=' . $row['group_story_id'] . '">Редактирай</a></td>
</tr>';
}
echo '</table>';
if ($_GET['mode'] == "edit" && $_GET['id'] > 0) {
$id = (int) $_GET['id'];
$rs = mysql_query('SELECT * FROM group_story WHERE group_story_id=' . $id);
$ed_info = mysql_fetch_assoc($rs);
}
echo '
</center>
</div>
<div class="group_story">
<center><b>Добавяне и редактиране на групи</b><br /><hr style="size: auto; color: #000000"/>
<form method="post" action="group_story.php">
Име на категорията:<br />
<input type="text" name="group_name" value="' . $ed_info['name'] . '" /><br />
Описание:<br />
<textarea name="desc" rows="5" cols="25">' . $ed_info['desc'] . '</textarea><br />
<input type="hidden" name="group_add" value="1" />
<input type="submit" name="Добави/Обнови група" value="Добави/Обнови група" />';
if ($_GET['mode'] == "edit") {
echo '<input type="hidden" name="edit_id" value="' . $_GET['id'] . '" />';
}
echo '
</form>
</center>
</div>
</div>';
footer();
?>