Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost"; // Host name
- $username="root"; // Mysql username
- $password=""; // Mysql password
- $db_name="slate"; // Database name
- $tbl_name="posts"; // Table name
- echo "TEST Username or Password";
- // Connect to server and select databse.
- mysql_connect("$host", "$username", "$password")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- $class=$_POST['class'];
- $sql="SELECT post FROM $tbl_name WHERE class='$class'";
- $result=mysql_query($sql);
- // Mysql_num_row is counting table row
- $count=mysql_num_rows($result);
- // If result matched $myusername and $mypassword, table row must be 1 row
- while($row = mysql_fetch_array($result))
- {
- echo "<div>";
- echo $row['post'];
- echo "<br />";
- echo "</div>";
- }
- mysql_close($con);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement