Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
miro_94 каза:Значи правя си админ панел.И на кода за категории съм си сложил поле за изтриване.Та въпроса ми е какво трябва да се направи за да се изтрие точно определен запис от БД?
$db = "database";
$sql = "DROP TABLE `$db`";
$delete = mysql_query($sql) or die("Грешка при изтриване на базата данни: $db");
<?php include("conn.php"); ?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Административен панел</title>
<style type="text/css">
</style></head>
<body>
<?php
$r = @mysql_select_db("news", $conn)
or die(mysql_error());
$zaiavka="select * from category";
$r = mysql_query($zaiavka, $conn)
or die(mysql_error());
while($row=mysql_fetch_array($r))
{
$cats .=
"<tr>
<td width=\"20%\" align=\"center\">$row[id]</td>
<td width=\"75%\" align=\"center\">$row[value]</td>
<td width=\"5%\" align=\"center\"><a href=\"\">DEL</a></td>
</tr>";
}
?>
<table width="700" height="67" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<td colspan="2" align="center"><h2>Административен панел</h2></td>
</tr>
<tr>
<td width="35%" height="18"><p><strong>Добави категория</strong></p>
<p><a href="all.php">Виж добавените новини</a></p></td>
<td width="65%" align="center" valign="top"><p>Добавени категории:</p>
<table width="200" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="20%" align="center">№</td>
<td width="75%" align="center">Категория</td>
<td width="5%" align="center">Действие</td>
</tr>
<?php
echo "$cats";
?>
</table>
<form action="addcat.php" method="post">
<p>Име на категория :
<input name="cat" type="text" class="text" id="cat" />
<input type="submit" name="submit" id="submit" value="Submit" />
</p>
</form>
<?php
if(isset($_POST['submit'])){
$category = $_POST['cat'];
$sql = "INSERT INTO category (id, value) VALUES ('', '$category');";
$result = mysql_query($sql);
if($result == true){
echo "Категорията е добавена успешно!";
}
else {
echo "Категорията не е добавена!";
}
}
?></td>
</tr>
</table>
</body>
</html>