Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db= new PDO('mysql:host=localhost;dbname=xxx','xxx','xxx');
- //gauname visus turnyrus
- $posts=$db->prepare("SELECT * FROM turnyrai");
- $posts->execute();
- //tikrinam ar yra postu
- if($posts->rowCount() > 0)
- {
- while($fetch = $posts->fetch(PDO::FETCH_ASSOC))
- {
- $id = $fetch['id'];
- $pavadinimas = $fetch['pav'];
- $aprasymas = $fetch['aprasymas'];
- $data = $fetch['data'];
- $laikas = $fetch['laikas'];
- $img = $fetch['img'];
- $tipas = $fetch['tipas'];
- ?>
- <h3 style="border-bottom: 1px solid #ddd;"><a href="" style="color: #4aaee7;"><?php echo $pavadinimas; ?></a></h3>
- <p><?php echo $aprasymas;?></p>
- <?php
- $uid=$_SESSION['id'];
- $sql=$db->prepare("SELECT * FROM fdlikes WHERE pid=$id and user=$uid");
- $sql->execute(array($id, $uid));
- if($sql->rowCount()==1){
- echo '<a href="#" class="like" id="'.$pid.'" title="Unlike">Unlike</a>';
- }else{
- echo '<a href="#" class="like" id="'.$pid.'" title="Like">Like</a>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement