Advertisement
ioncap

News articles PHP part

Jul 25th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.81 KB | None | 0 0
  1. • Bootstrap Grid system with "News-Updates"
  2.    ○ The information comes from sql server
  3.    ○ Contact Modal works as in the tutorial
  4.  
  5. I want to send the row id of the news article via $_GET
  6. It works together with the Javascript identifier
  7.  
  8. I only get to see the Modal backdrop :(
  9. -----------------------------------------------------------------------------------------------------------------------------------------
  10. -----------------------------------------------------------------------------------------------------------------------------------------
  11.     <div class = "container">
  12.         <div class = "row">
  13.        
  14.             <?php
  15.             $count = "3"; //Article count blox (example: 3  -->  3/12=4 means 4 news boxes will appear)
  16.            
  17.            
  18.             $query = "SELECT * FROM news ORDER BY id DESC LIMIT 4";
  19.            
  20.             $result = mysql_query($query);
  21.             if (!$result)
  22.                 {
  23.                 echo mysql_error() . $query;
  24.                 }
  25.             else
  26.                 {
  27.                 while($row = mysql_fetch_array($result))
  28.                 {
  29.                 echo
  30.                 '<div class = "col-md-' . $count . ' float-left"><div style="height:250px;" class="alert alert-info alert-dismissible">
  31.                 <button class="close" data-dismiss="alert">&times;</button>
  32.                 <h3 class="text-center"><a href = "?article_nr=' . $row['id'] . '&#update" data-toggle = "modal">' .
  33.                 $row['title'] . '</a></h3><h4>' .
  34.                 $row['subject'] . '</h4><p>' .
  35.                 $row['text'] . '</p><br><br><br>' .
  36.                 '<div class="b-1">
  37.                
  38.                 <a data-toggle="modal" href="?article_nr=' . $row['id'] . '#news" class="btn btn-primary">Read more</a>
  39.                 <h5 style=" margin:0; float:right; display:inline-block; top:20px;"><small>' .
  40.                 mb_strimwidth($row['date'], 14, 14) . '&nbsp;&nbsp;&nbsp;&nbsp;' . mb_strimwidth($row['date'], 5, 5) .                      '</small></h5></div></div></div>';
  41.                 }
  42.                 }
  43.         ?>
  44.                     </div>          
  45.         </div>     
  46.     </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement