Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html><html>
- <head>
- <meta charset="utf-8">
- </head>
- <body style="background-color:#ffcc66;">
- <div style="background-color:#734d00; width:50%; height:100px; float:left; text-align:center; color:white; font-size:500%;">
- NEWSY
- </div>
- <div style="float:left; width:25%; height:100px; background-color:#734d00; color:white;">
- <h3>Wybierz datę z kalendarza:</h3>
- <form method="post" action="">
- <input type="date" name="data"/>
- <input type="submit"/>
- </form>
- </div>
- <div style="float:left; width:25%; height:100px; background-color:#734d00; color:white;">
- <center>
- <h3>Wybierz datę z istniejących:</h3>
- <form method="post" action="">
- <select name="data">
- <option value="pokazwszystkie">Pokaż wszystkie</option>
- <?php
- $polaczenie=mysqli_connect('localhost','root','','news_agata');
- mysqli_set_charset($polaczenie,"utf8");
- $wynik1=mysqli_query($polaczenie,'select data from tytul group by data desc;');
- while ($wiersz=mysqli_fetch_array($wynik1))
- {
- echo '<option value="'.$wiersz['data'].'">'.$wiersz['data'].'</option>';
- }
- echo '</select>';
- echo '<input type="submit"/>';
- echo '</form>';
- echo '</center>';
- echo '</div>';
- echo '<div style="clear:both; background-color:#cc9933; width:95%; padding:2.5%;">';
- function funkcja()
- {
- $polaczenie=mysqli_connect('localhost','root','','news_agata');
- mysqli_set_charset($polaczenie,"utf8");
- $wynik1=mysqli_query($polaczenie,'select data from tytul group by data desc;');
- @$wybranadata=$_POST['data'];
- if ($wybranadata=="pokazwszystkie")
- {
- $wynik2=mysqli_query($polaczenie,'select tytul, tresc, autor, data from tytul,tresc where tytul.id_news=tresc.id_news order by data desc;');
- while ($wiersz=mysqli_fetch_array($wynik2))
- {
- echo '<h1>'.$wiersz['tytul'].'</h1>';
- echo '<p>'.$wiersz['tresc'].'</p>';
- echo '<h6> Autor: '.$wiersz['autor'].'</h6>';
- echo '<h6> Data: '.$wiersz['data'].'</h6></br></br>';
- }
- }
- else
- {
- $wynik2=mysqli_query($polaczenie,'select tytul, tresc, autor, data from tytul,tresc where tytul.id_news=tresc.id_news and data="'.$wybranadata.'" order by data desc;');
- while ($wiersz=mysqli_fetch_array($wynik2))
- {
- echo '<h1>'.$wiersz['tytul'].'</h1>';
- echo '<p>'.$wiersz['tresc'].'</p>';
- echo '<h6> Autor: '.$wiersz['autor'].'</h6>';
- echo '<h6> Data: '.$wiersz['data'].'</h6></br></br>';
- }
- }
- }
- if (funkcja()==null)
- {
- echo "Żaden news nie pasuje do wybranej daty.";
- }
- ?>
- </div>
- <div style="background-color:#734d00; width:100%; text-align:center; color:white;">
- Autor strony: Agata Prażmo
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement