Файл: Как писать концепцию.pdf

Добавлен: 23.10.2018

Просмотров: 2602

Скачиваний: 11

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
background image

 

 

Листинг table/tehnika.php 

<html> 
<head> 
<title>Техника</title> 
</head> 
<style> 
 
.action_remove { 
width: 11px; 
height: 11px; 
display: inline-block; 
vertical-align: top; 
margin-top: 2px; 
background: transparent url(../image/catalog.png) -30px -29px no-repeat; 

.red { 
width: 15px; 
height: 15px; 
display: inline-block; 
vertical-align: top; 
margin-top: 2px; 
background: transparent url(../image/r.ico); 

</style> 
<body> 
<form align="center" method="GET"> 
<? 
 
 

 

 

$connection = mysql_connect("localhost","root"); 

 

 

 

if(!$connection) die("Ошибка доступа к базе данных"); 

 

 

 

 

if(!mysql_select_db("грицина")) 

 

 

 

die("База данных отсутствует. Приносим свои извинения"); 

 
 

$qresult = mysql_query("SELECT * FROM группы_техники");  

 

if(!$qresult) die("Ошибка доступа к базе данных.Приносим свои 

извинения"); 
 
$items = array(); 
 

while($p = mysql_fetch_assoc($qresult)){ 

 

$items[] = $p;} 

 

 

echo 'Группа техники <select name="kod">'; 

 

 

foreach($items as $item) 

 

 

echo '<option>'.$item['номер_группы'].'</option>'; 


background image

 

 

echo '</select>'; 
 
print" <input type='text' name='nt' placeholder='номер техники'>"; 
 

 

 

 

 

 

$qresult = mysql_query("SELECT * FROM производители");  

 

if(!$qresult) die("Ошибка доступа к базе данных.Приносим свои 

извинения"); 
 
$items = array(); 
 

while($p = mysql_fetch_assoc($qresult)){ 

 

$items[] = $p;} 

 

 

echo 'Номер производителя <select name="np">'; 

 

 

foreach($items as $item) 

 

 

echo '<option>'.$item['номер_производителя'].'</option>'; 


echo '</select>'; 
 
print" 
 

<input type='text' name='m' placeholder='модель'> 

 

<input type='text' name='s' placeholder='срок гарантии'> 

 

<input type='text' name='c' placeholder='цена'> 

 

<input type='text' name='kol' placeholder='количество'>"; 

?> 

 

 

<input type="submit" name="k" value='добавить'></form> 

 

 

<table border="1" align="center"> 
<tr> 
 

<th>№ группы</th> 

 

<th>№ техники</th> 

 

<th>№ производителя</th> 

 

<th>Модель</th> 

 

<th>Срок гарантии</th> 

 

<th>Цена</th> 

 

<th>Количество</br> 

 

<th><div class="action_remove"></div></th> 

 

<th><div class="red"></div></th> 

</tr> 
<?php 
$n_pok=$_GET["kod"]; 
$fam=$_GET["nt"]; 
$nam=$_GET["np"]; 
$ser_p=$_GET["m"]; 
$tel=$_GET["s"]; 
$kred=$_GET["c"]; 


background image

 

 

$kol=$_GET["kol"]; 
$udal=$_GET["udal"]; 
 if (isset($_GET["k"])) 
 { 
 

$dob=mysql_query("INSERT INTO техника (номер_группы, 

номер_техники,  
 

номер_производителя, модель,срок_гарантии, цена, количество)  

 

VALUES ('".$n_pok."','".$fam."','".$nam."','".$ser_p."', 

 

'".$tel."','".$kred."','".$kol."')"); 


 

$ud=mysql_query("delete from техника where номер_техники='$udal'"); 

 

 

 

$qresult = mysql_query("SELECT * FROM техника");  

if(!$qresult) die("Ошибка доступа к базе данных. 
Приносим свои извинения"); 
while ($p=mysql_fetch_assoc($qresult)) 

$j=$p["номер_техники"]; 
$m=$p["модель"]; 
$sg=$p["срок_гарантии"]; 
$cena=$p["цена"]; 
$k=$p["количество"]; 
print "\n<form method='GET'><tr align='center'> 
 

<td>{$p["номер_группы"]}</td> 

 

<td>{$p["номер_техники"]}</td> 

 

<td>{$p["номер_производителя"]}</td> 

 

<td>{$p["модель"]}</td> 

 

<td>{$p["срок_гарантии"]}</td> 

 

<td>{$p["цена"]}</td> 

 

<td>{$p["количество"]}</td> 

 

<td><a href='tehnika.php?udal=$j &nt=$nt' target='sklad' 

title='удалить'><div class='action_remove'></td></div> 
 

<td><a href='teh_izm.php?nt=$j &m=$m &sg=$sg &cena=$cena &k=$k' 

target='sklad' title='изменить'><div class='red'></td></div> 
 

</tr>\n</form>"; 


?> 
</table><br> 
</body> 
</html> 
 
 

 
 
 


background image

 

 

Листинг table/the_izm.php 

<html> 
<head> 
<title>Изменение техники</title> 
</head> 
<body> 
 
<table border="1" align="center"> 
<tr> 
 

<th>№ техники</th> 

 

<th>Модель</th> 

 

<th>Срок гарантии</th> 

 

<th>Цена</th> 

 

<th>Количество</br> 

</tr> 
<? 
 
print"<form align='center' method='POST'>"; 
$nt=$_GET["nt"]; 
 
$mo=$_GET["m"]; 
$m=$_POST["mo"]; 
 
$s=$_GET["sg"]; 
$su=$_POST["su"]; 
 
$cena=$_GET["cena"]; 
$cen=$_POST["cen"]; 
 
$k=$_GET["k"]; 
$kol=$_POST["kol"]; 
$connection = mysql_connect("localhost","root"); 
if(!$connection) die("Ошибка доступа к базе данных"); 
 

if(!mysql_select_db("грицина")) 

 

 

die("База данных отсутствует. Приносим свои dfgh извинения"); 

 

 

if($_POST["mo"]) 
 

{$r = mysql_query("update техника set модель='$m' where 

модель='$mo'"); } 
 

 

elseif($_POST["su"]) 

 

 

 

{$r = mysql_query("update техника set срок_гарантии='$su' 

where срок_гарантии='$s' and номер_техники='$nt'"); } 
 

 

 

 

 

elseif($_POST["cen"]) 


background image

 

 

 

 

 

{$r = mysql_query("update техника set цена='$cen' where 

цена='$cena' and номер_техники='$nt'"); }  

 

 
 

 

elseif($_POST["kol"]) 

 

 

 

{$r = mysql_query("update техника set количество='$kol' 

where количество='$k' and номер_техники='$nt'"); }   

 

 

 

 

$qresult = mysql_query("SELECT * FROM техника where 

номер_техники='$nt'");  
if(!$qresult) die("Ошибка доступа к базе данных. 
Приносим свои извинения"); 
while ($p=mysql_fetch_assoc($qresult)) 

print "\n<tr align='center'> 
 

<td>{$p["номер_техники"]}</td> 

 

<td>{$p["модель"]}<br><input type='text' size='8' name='mo' 

value=''></td> 
 

<td>{$p["срок_гарантии"]}<br><input type='text' size='8' name='su' 

value=''></td> 
 

<td>{$p["цена"]}<br><input type='text' size='8' name='cen' value=''></td> 

 

<td>{$p["количество"]}<br><input type='text' size='8' name='kol' 

value=''></td> 
 

</tr>\n"; 


?> 
</table><br> 
<p><input type="submit" name="ok" value='ok'></form> 
</body> 
</html> 
 

 

Листинг katalog.php 

<html> 
<head> 
<title>Каталог</title> 
</head> 
<style> 
.th { 
padding: 2px; 
font-size: 12px; 
color: #FFF; 
font-weight: normal; 
border-left: 10px solid #087CCD; 
border-width: 12px solid #087CCD; 
background: url(../image/bar_bl.png) no-repeat 5px top #087CCD;