Advertisement
SSYT

get_like.php

May 10th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2.     header('Access-Control-Allow-Origin: http://myscripts.forumz.ro');
  3.     $mysql = mysql_connect("localhost", "u719064522_bitcd", "5vEelfGVsC") or die(mysql_error());
  4.     if(!$mysql)
  5.         print("Conexiunea cu serverul a esuat !");
  6.     $database = mysql_select_db("u719064522_stupd") or die(mysql_error());
  7.     if(!$database)
  8.         print("Conexiunea cu baza de date a esuat !");
  9.  
  10.     $query = "SELECT * FROM `likes` WHERE `PostID`=". $_GET['post_id'] ." ORDER BY `PostID` LIMIT 0, 30";
  11.     $result = mysql_query($query);
  12.    
  13.     if(mysql_num_rows($result) > 0)
  14.     {
  15.         while($like_row = mysql_fetch_assoc($result))
  16.         {
  17.             if($_GET['post_id']) {
  18.                 if($_GET['post_id'] == $like_row['PostID'])
  19.                 {
  20.                     $likes = "<p class='post-". $like_row['PostID'] ."'>People like's this: ".$like_row['People']." (<strong>". $like_row['Count'] ." like's</strong>)</p>";
  21.                     echo $likes;
  22.                 }
  23.             } else echo "No like this !";
  24.         }
  25.     } else $noLike = "No like's here"; echo $noLike;
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement