| <?php |
| function get_menu($data, $parent = 0) { |
| static $i = 1; |
| $tab = str_repeat("\t\t", $i); |
| if (isset($data[$parent])) { |
| $html = "\n$tab<ul>"; |
| $i++; |
| foreach ($data[$parent] as $v) { |
| $child = get_menu($data, $v->id); |
| $html .= "\n\t$tab<li>"; |
| $html .= '<a href="'.$v->url.'">'.$v->title.'</a>'; |
| if ($child) { |
| $i--; |
| $html .= $child; |
| $html .= "\n\t$tab"; |
| } |
| $html .= '</li>'; |
| } |
| $html .= "\n$tab</ul>"; |
| return $html; |
| } else { |
| return false; |
| } |
| } |
| |
| mysql_connect('localhost', 'root', ''); |
| mysql_select_db('tes'); |
| |
| $result = mysql_query("SELECT * FROM menu ORDER BY menu_order"); |
| while ($row = mysql_fetch_object($result)) { |
| $data[$row->parent_id][] = $row; |
| } |
| |
| $menu = get_menu($data); |
| ?> |
| <!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>Sistem Informasi OBC </title> |
| <link rel="stylesheet" type="text/css" href="jquerycssmenu.css" /> |
| <script type="text/javascript" src="jquery-1.3.2.min.js"></script> |
| <script type="text/javascript" src="jquerycssmenu.js"></script> |
| <style type="text/css"> |
| body { font: 11px Tahoma, sans-serif; margin: 0; padding: 0; } |
| a { color: |
| |
| </style> |
| </head> |
| <body> |
| <align="center"><img src="telkom.jpg" height="150" width="1350"></align> |
| |
| <div id="myjquerymenu" class="jquerycssmenu"> |
| <?php echo $menu; ?> |
| <br style="clear: left" /> |
| </div> |
| |
| <div id="content"> |
| |
| <!-- form quick search --> |
| <form name="form1" method="get" action=""> |
| Search : <input type="text" name="q" id="q"/> <input type="submit" value="Search"/> |
| </form> |
| <!-- menampilkan hasil pencarian --> |
| <?php |
| |
| if(isset($_GET['q']) && $_GET['q']){ |
| $conn = mysql_connect("localhost", "root", ""); |
| mysql_select_db("galeri"); |
| $q = $_GET['q']; |
| $sql = "select * from foto where nama_file like '%$q%' or |
| nama like '%$q%' or alamat like '%$q%' or gender like '%$q%' or pendidikan like '%$q%' or deskripsi like '%$q%' or tanggal like '%$q%'"; |
| $result = mysql_query($sql); |
| if(mysql_num_rows($result) > 0){ |
| ?><table background="id.jpg"> |
| <tr> |
| <td></td></tr> |
| |
| |
| <?php |
| while($siswa = mysql_fetch_array($result)){?> |
| <Table Background="tb2.jpg"> |
| <td width="300" height="500"><pre> <img src="images/<?php echo $siswa['nama_file'];?>" alt="" width="190" border="0"/><br><br> <?php echo $siswa['nama'];? |
| |
| ></td></tr> |
| |
| |
| <?php }?> |
| </table> |
| <?php |
| }else{ |
| echo 'Data not found!'; |
| } |
| } |
| ?> |
| |
| |
| </div> |
| |
| </body> |
| </html> |