<?php mysql_connect("localhost", "u449949546_pesni", "25945852") or die (mysql_error ()); mysql_select_db("PESNI") or die(mysql_error()); $title = $_GET['song']; $time = date("Y-m-d H:i:s"); mysql_query("SET NAMES 'utf8'"); mysql_query("INSERT INTO songs (Title, time) VALUES ('$title', '$time')") or die ("Error: ".mysql_error()); mysql_close(); ?>
<?php mysql_connect("localhost", "u449949546_pesni", "25945852") or die (mysql_error ()); mysql_select_db("PESNI") or die(mysql_error()); mysql_query("SET NAMES 'utf8'"); $res = "SELECT Title, time FROM songs ORDER BY time DESC limit 5"; $rs = mysql_query($res); while($row = mysql_fetch_array($rs)) { echo $row['time'] . " " . $row['Title'] . "<br />"; } mysql_close(); ?>