Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mysql_hostname = 'localhost';
- $mysql_username = 'root';
- $mysql_password = 'password';
- $mysql_database = 'test';
- mysql_connect($mysql_hostname, $mysql_username, $mysql_password) or die(mysql_error());
- mysql_select_db($mysql_database);
- class news {
- function post( $title, $content ) {
- return '<a href="#"><h2>'.$title.'</h2></a>'.
- '<p>'.$content.'</p>';
- }
- function show( $amount ) {
- $query = mysql_query('SELECT id, date, title, content FROM archive ORDER BY date DESC, time DESC LIMIT '.$amount);
- while ($fetch = mysql_fetch_array($query, MYSQL_ASSOC)) {
- return '<a id="'.$fetch['id'].'"><h2>'.$fetch['title'].'</h2></a>'.
- '<p>'.$fetch['content'].'</p>';
- }
- return '<p>show '.$amount.'</p>';
- }
- }
- ?>
Add Comment
Please, Sign In to add comment