Skip to content

Instantly share code, notes, and snippets.

@akakiev
Created June 28, 2017 16:12
Show Gist options
  • Select an option

  • Save akakiev/525fbc8c17e913a42ffcbc8593da6150 to your computer and use it in GitHub Desktop.

Select an option

Save akakiev/525fbc8c17e913a42ffcbc8593da6150 to your computer and use it in GitHub Desktop.
The_best_automobiles
body{
background:#111111;
color:white;}
#center{
width:100%;
margin-top:-25px;}
td{
padding:10px 20px;
background:#111111;}
#logo_text{
height:10px;
font:24px impact;
letter-spacing:3px;}
#menu a{
font:bold 20px tahoma;
display:block;
margin-top:18px;
margin-left:30px;
text-decoration:none;
color:#909090;}
#menu a:hover{
color:#ffffff;
}
#menu a.action{
color:#ffffff;
}
.foto_car img{
width:100%;
}
<!DOCTYPE html>
<html>
<head>
<title>Кращі автомобілі</title>
<link rel="stylesheet" type="text/css" href="t14z3.css">
</head>
<body>
<?
include "start1.php";
$menu=get_menu();
$am=get_action_menu();
$foto=get_foto($am);
?>
<table id='center' cellspacing="0" border="0" bordercolor="#fff">
<tr id='top'>
<td id='logo_text' width="10">
КРАЩІ АВТОМОБІЛІ СВІТУ
</td>
<td id='menu' align='left' >
<? print_menu($menu,$am); ?>
</td>
</tr>
<tr valign='top'>
<td colspan='2' id='content'>
<? print_foto($foto); ?>
</td>
</tr>
</table>
</body>
<?
function get_action_menu(){
if(isset($_GET['menu'])){
$menu=$_GET['menu'];
}else{
$menu=1;
}
return $menu;
}
function get_menu(){
$tab=mysql_query("SELECT id, name FROM car ");
$i=1;
while($row=mysql_fetch_array($tab)){
$menu[$i]['id']=$row['id'];
$menu[$i]['name']=$row['name'];
$i++;
}
return $menu;
}
function get_foto($am){
$tab=mysql_query("SELECT foto FROM foto WHERE id_car='$am'");
$i=1;
while($row=mysql_fetch_array($tab)){
$foto[$i]=$row['foto'];
$i++;
}
return $foto;
}
function print_menu($m,$am){
for($i=1;$i<=count($m);$i++){
$cl="";
if($i==$am){
$cl="class='action'";
}
echo"<a
style='float:left;'
href='?menu=".$m[$i]['id']."'"
.$cl.
">"
.$m[$i]['name'].
"&nbsp&nbsp&nbsp&nbsp
</a>";
}
}
function print_foto($f){
for($i=1;$i<=count($f);$i++){
echo"<div class='foto_car'>";
echo "<img src='".$f[$i]."'>";
echo"</div>";
}
}
?>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment