Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- error_reporting(-1);ini_set('display_errors', 1);
- $myServer = "mysql8.000webhost.com";
- $myUser = "a1761169_chat";
- $myPass = "site123";
- $myDB = "a1761169_chat";
- //Connection to the database
- $dbhandle = mysql_connect($myServer, $myUser, $myPass)
- or die("Couldn't connect to SQL Server on $myServer");
- //Select a database to work with
- $selected = mysql_select_db($myDB, $dbhandle)
- or die("Couldn't open database $myDB");
- $where = "";
- if(isset($_GET['id'])){
- $id = $_GET['id'];
- $where = " WHERE id = $id";
- }
- //Declare the SQL statement that will query the database
- $query = "SELECT * FROM `topics`$where";
- //Execute the SQL query and return records
- $result = mysql_query($query)
- or die('A error occured: ' . mysql_error());
- //Show result
- while ( $record = mysql_fetch_array($result) )
- {
- if(isset($_GET['id'])){ echo $record['topic_input']; }
- echo '<div id="content" align="center">' . '<a href="index.php?id=' . $record["id"] . ' ">'. $record["topic_name"] .'</a>' . "<br><br>" . '<table style="word-wrap:break-word;table-layout:fixed;" width="600px" border="1"><tr><td>'.$record['topic_input'].'</td></tr></table>' . '</div>';
- }
- //Free result set memory
- mysql_free_result($result);
- //Close the connection
- mysql_close($dbhandle);
- ?>
- <html>
- <head>
- </head>
- <body>
- </body>
- </html>
Add Comment
Please, Sign In to add comment