Skip to content

Instantly share code, notes, and snippets.

@ginc0der
Last active December 16, 2015 16:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ginc0der/5464454 to your computer and use it in GitHub Desktop.
<?php
$host = "localhost";
$usernameHost = "root";
$passwordHost = "";
$database = "digital";
mysql_connect($host,$usernameHost,$passwordHost) or die(mysql_error());
mysql_select_db($database)or die(mysql_error());
?>
<html>
<head>
<title>Breaking News</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
setInterval(function(){$('.breaking').load("news.php");},100);
function ticker(){
$('.slide li:first').slideUp(function(){
$(this).appendTo($('.slide')).slideDown();
});
}
setInterval(function(){ticker()},3000);
</script>
<style>
.breaking{
font-size: 20px;
color:blue;
font-family:Segoe UI;
}
.ticker-box{
width:50%;
border:#666 1px dotted;
height:37%;
box-shadow:0px 0px 5px #ddd;
color:#000;
list-style:none;
overflow:hidden;
}
.ticker-box .title{
background: #4096ee; /* Old browsers */
background: -moz-linear-gradient(top, #4096ee 10%, #60abf8 52%, #7abcff 87%);
text-align:center;
padding:2% 0 2% 0;
margin:0 0 2% 0;
}
.ticker-box ul{
list-style:none;
margin:0;
padding:0;
}
.ticker-box li{
margin:0 5px;
}
.ticker-box li .mata-kuliah{
float:left;
width:30%;
background:#C63;
margin:2% 0 0 0;
}
.ticker-box li .waktu{
float:left;
width:30%;
background:#999;
margin:2% 0 0 0;
}
.ticker-box li .ruangan{
float:left;
background:#09F;
width:40%;
margin:2% 0 3% 0;
}
</style>
</head>
<body>
<marquee class="breaking"><?php include "news.php"; ?></marquee>
<div class="ticker-box">
<?php include "matkul.php"; ?>
</div>
</body>
</html>
-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Inang: 127.0.0.1
-- Waktu pembuatan: 26 Apr 2013 pada 01.59
-- Versi Server: 5.5.27
-- Versi PHP: 5.4.7
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Basis data: `digital`
--
CREATE DATABASE `digital` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `digital`;
-- --------------------------------------------------------
--
-- Struktur dari tabel `news`
--
CREATE TABLE IF NOT EXISTS `news` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`news` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data untuk tabel `news`
--
INSERT INTO `news` (`id`, `news`) VALUES
(1, 'This News 1'),
(2, 'This News 2'),
(3, 'This News 3'),
(4, 'This News 4');
-- --------------------------------------------------------
--
-- Struktur dari tabel `schedule`
--
CREATE TABLE IF NOT EXISTS `schedule` (
`id_schedule` int(11) NOT NULL AUTO_INCREMENT,
`kuliah` varchar(200) NOT NULL,
`hari` varchar(200) NOT NULL,
`ruangan` varchar(200) NOT NULL,
PRIMARY KEY (`id_schedule`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data untuk tabel `schedule`
--
INSERT INTO `schedule` (`id_schedule`, `kuliah`, `hari`, `ruangan`) VALUES
(1, 'Network', 'Monday', 'U204'),
(2, 'Automata', 'Tuesday', 'U205'),
(3, 'PHP', 'Wednesday', 'U205'),
(4, 'HTML', 'Thursday', 'U205'),
(5, 'C++', 'Friday', 'U205');
-- --------------------------------------------------------
--
-- Struktur dari tabel `slide`
--
CREATE TABLE IF NOT EXISTS `slide` (
`idslide` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL,
`content` text NOT NULL,
`image` varchar(200) NOT NULL,
`date` date NOT NULL,
`time` time NOT NULL,
PRIMARY KEY (`idslide`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data untuk tabel `slide`
--
INSERT INTO `slide` (`idslide`, `title`, `content`, `image`, `date`, `time`) VALUES
(3, 'asdasd', 'asdfghj', 'image/Water lilies.jpg', '2013-04-25', '08:50:54');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<div class="title">
<?php
include "config.php";
echo date("l");
?>
</div>
<ul class="slide">
<?php
$query=mysql_query("SELECT * FROM schedule")or die(mysql_error());
while($data=mysql_fetch_array($query)){
echo '<li style="display:list-item;">
<div class="mata-kuliah">'.
$data['kuliah'].
'</div>
<div class="waktu">'.
$data['hari'].
'</div>
<div class="ruangan">'.
$data['ruangan'].
'</div>
</li>';
}
?>
</ul>
<?php
include "config.php";
$query = mysql_query("SELECT * FROM news");
while($data=mysql_fetch_array($query)){
echo $data['news']." | ";
}
?>
@fjorgemota
Copy link

But...The JS code in index.php file is different from what you have published in Stackoverflow (and yes, i'm the same "Fernando Mota" user of the Stackoverflow)

@ginc0der
Copy link
Author

yes, different that original from my self
i've try your code but dosn't work so I've make it back to original >_<

@ginc0der
Copy link
Author

now, that include your code Fernando :) may you can help me :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment