1j0e

getsuggestions.php

May 16th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2.  
  3. $con = mysql_connect( "localhost","root","root" );
  4.  
  5.  
  6. if ( !$con ){
  7.  
  8. die( 'Could not connect: ' . mysql_error() );
  9.  
  10. } else {
  11.  
  12. mysql_select_db( "lolerstream", $con );
  13.  
  14. $query = "SELECT * FROM suggestions";
  15.  
  16. $result = mysql_query( $query,$con ) or die( 'Could not execute query: ' . mysql_error() );
  17.  
  18. if ( mysql_num_rows( $result ) ) {
  19.  
  20. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  21. printf(" <div class='suggestion'> %s - %s </div> \n ", $row["submitdate"], $row["content"]);
  22. }
  23.  
  24. }
  25.  
  26. }
  27. mysql_close($con)
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment