Jump to content

narutofan

Members
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About narutofan

  • Rank
    Member
  1. Hi, i need to create a phpfreaks style tagging system in one of my projects and i'm stumped at how to get user input value at keypress after they type the "@" symbol in tinymce editor and i need help on how to create a phpfreaks style dropdown list and how to capture the clicked usernames. i think they are using tinymce3 editor to post updates. can anyone help me regardiing this problem.
  2. @Barand come on man i'm asking because i don't know how to do it and you are making fun of me.
  3. hi @requinix, i want to create a dropdown style tagging sys as in this forum can i know how to do it in jquery and php. And i would also like to know how to create a facebook style read more dropdown link after some 250 words??
  4. narutofan

    password_verify not working

    finally found the solution after googling a bit. Seems like password_hash function requires 60 characters in DB but i gave only 55 after changing it everything works fine now thankis for your patience @requinix
  5. narutofan

    password_verify not working

    Hi, i'm currently facing this problem where i need to verify passwords using password_verify function. After creating the password with password_hash function when i try to login its not logging in and when i try to ouput it the var_dump function for password_verify function is saying bool false. I coudn't figure out where i'm going wrong.it would be of great help if you guys could solve it. here is the code for login script: error_reporting(E_ALL); include_once 'dbconfig.inc.php'; if (isset($_POST['submit-login'])) { $uname= htmlentities($_POST['unamel']); $unamel= stripslashes($uname); $query="select * from user where uname=:uname and activated='1'"; $stmt=$conn->prepare($query); $stmt->bindValue(":uname",$unamel); $stmt->execute(); $user1=$stmt->fetchAll(); $hash='$2y$10$wCt5GTBB1oCFzhc0fh5GeeATPjP8mvxQsFH0taabQdXfqu0prOVCG'; $pass1="123456"; print_r($hash); $passl= password_verify($pass1, $hash); var_dump($passl); exit(); } password hash script: include '../includes/dbconfig.inc.php'; $sess_id=(int)$_SESSION['id']; $ph= htmlentities($_POST['phone']); $em= htmlentities($_POST['email']); $un= htmlentities($_POST['uname']); $fn= htmlentities($_POST['fname']); $ln= htmlentities($_POST['lname']); $pssd= $_POST['current_pass']; $n_pssd= password_hash($_POST['new_password'],PASSWORD_BCRYPT); $privacy=(int)$_POST['privacy']; $phone= stripslashes($ph); $email= stripslashes($em); $uname= stripslashes($un); $fname= stripslashes($fn); $lname= stripslashes($ln); $current_pass= $pssd; $new_pass= $n_pssd; print_r($new_pass); exit();
  6. narutofan

    php script not running to finish point

    finally found the solution i deleted the check_regex function i intended it for array_filter function and now it works fine thanks for your patience all.
  7. narutofan

    php script not running to finish point

    and it is not catching any error at the end
  8. Hi, i'm currently facing a problem of php script not running to the finish point of the script. the code actually tries to find tags preceded either with "!" or "@" and if it doesn't match it outputs user input data in to a update query at the end and this is where the script isn't behaving properly it tries to match the tags but it is not updating in to DB i don't know where i'm going wrong.The code might be long but that is all there is to it. include_once '../includes/dbconfig.inc.php'; if(strlen(htmlentities($_POST['data']))<1){ echo "Data empty!"; exit(); } #clean all the post vars that will interact with the DB. #ideal for search results page $u_id=(int)$_POST['id']; $type=htmlentities($_POST['type']); $account_name= htmlentities($_SESSION['uname']); $data= htmlentities($_POST['data']); $tit= htmlentities($_POST['title']); $sess_id=(int)$_SESSION['id']; $title= stripslashes($tit); $sql="select count(user_id) from user where uname=:account_name and activated='1' limit 1"; $stmth=$conn->prepare($sql); $stmth->bindparam(":account_name",$account_name); $stmth->execute(); $row=$stmth->rowCount(); if ($row<1) { echo "Account doesn't exist"; exit(); } $dat= explode(" ", $data);//names are exploded in to array $data1=""; foreach($dat as $d){ if(strpos($d ,'!') !== FALSE ){ $d_p=""; $i=0; $tag=""; $d2=count($dat); while ($i<$d2) { $d_w=$dat[$i]; $regex="/!+([a-zA-z0-9._-]+)/"; $regex1="/(?:\s|^)![A-Za-z0-9\-\.\_]+(?:\s|$)/"; $d1=preg_match_all($regex, $dat[$i],$output_preg,PREG_PATTERN_ORDER); function check_regex($data){ if ($data=="/(?:\s|^)![A-Za-z0-9\-\.\_]+(?:\s|$)/") { return $data; } } $i++; $d_p= array_column($dat,$output_preg[0][0],$regex1); $d_f= preg_grep($regex1, $d_p); $d_c= array_count_values($d_f); //print_r($d_c); foreach ($d_c as $d2) { if ($d2>=2) { $tag=1; } } } if($tag==1){ echo 1; exit(); } else { echo 0; } } elseif (strpos($d ,'@') !== FALSE) { $d1=str_replace("@", "", $d); //check if the user exists $stmt= $conn->prepare("select count(uname) from user where uname=:d1 and activated='1'"); $stmt->bindValue(":d1",$d1); $stmt->execute(); $count=$stmt->rowCount(); if($count>0){ $data1=str_replace("@$d1", "<a href='home.php?u={$d1}'>@$d1</a>", $data); $app = "Status post"; $note = $_SESSION['uname'].' Mentioned you in a Post: <br /><a href="home.php?u='.$_SESSION['uname'].'">'.$_SESSION['uname'].'&#39;s Profile</a><br><hr>'; $stmth= $conn->prepare("insert into notifications (username, initiator, app, note, date_time,user_id_n) values(:friend,:session,:app,:note,now(),:sess_id)"); $stmth->bindparam(":friend",$d1); $stmth->bindparam(":session",$_SESSION['uname']); $stmth->bindparam(":sess_id",$sess_id); $stmth->bindparam(":app",$app); $stmth->bindparam(":note",$note); $stmth->execute(); } } else { $data1=$data; } } #insert in to DB try { $stmt=$conn->prepare("update updates set account_name=:account_name,author=:session, title=:title ,update_body=:data1,time=now() where update_id=:u_id"); $stmt->bindparam(":account_name",$account_name); $stmt->bindparam(":session",$account_name); $stmt->bindparam(":title",$title); $stmt->bindparam(":data1",$data1); $stmt->bindparam(":u_id",$u_id); $stmt->execute(); }catch (PDOException $ex) { echo $ex->getMessage(); } echo 2;
  9. narutofan

    If statement not working after loop

    finally i found a solution all i had to do was add spaces to the anchor tag in hashtag function and the explode function started to separate the tag from the anchor tag and now the if st is working after the loop. function hashtags($dat) { $regex="/!+([a-zA-z0-9._-]+)/"; $dat1= preg_replace($regex, '<a href="hash_sys.php?tag=$1"> $0 </a>', $dat);<=see the space return $dat1;  }.... foreach ($tag_fetch as $row_s) { $data= stripslashes($row_s['update_body']); $data1= explode(" ",$data); <= this took care of the rest
  10. narutofan

    If statement not working after loop

    <?php $tag1=""; include 'includes/header.php'; if (isset($_SESSION['uname'])){ $tag= htmlentities($_GET['tag']); //$tag="!qwerty"; $data1=array(); $sql3="select * from updates"; $stmt_1=$conn->prepare($sql3); $stmt_1->execute(); $tag_fetch=$stmt_1->fetchAll(); $sql1="select * from group_posts where type <> '1'"; $stmt_t=$conn->prepare($sql1); $stmt_t->execute(); $data_fetch=$stmt_t->fetchAll(); function hashtags1($dat, $tag) { $regex="/#+([a-zA-z0-9._-]+)/"; return $post_data1; } function hashtags($dat) { $regex="/!+([a-zA-z0-9._-]+)/"; $dat1= preg_replace($regex, '<ahref="hash_sys.php?tag=$1">$0</a>', $dat); return $dat1; } ?> <div class="container-fluid"> <br><div class="row"> </div><br> <div class="row"> <div class="col-sm-2"> <?php include_once 'notification/friend_list.php'; ?> <?php include 'groups/group_list.php';?> </div> <div class="col-lg-8"> <table class="main_page"> <td class="div-col-left1"><div class="overflow"><h3>Users</h3> <?php foreach ($tag_fetch as $row_s) { $data= stripslashes($row_s['update_body']); $data1= explode(" ",$data); $tag1="!$tag"; $tag2=' <ahref="hash_sys.php?tag='.$tag.'">'.$tag1.'</a>'; $tag3= preg_replace('#<a.*?>(.*?)</a>#i', '\1', $data1); //print_r($data1); foreach($data1 as $d){ // echo '<pre>'; print_r($d); echo '</pre>'; $tag1="!$tag"; $tag2=" #<a.*?>(.*?)</a>#i', '\1'".$tag1."</a>"; $tag3= preg_replace('#<a.*?>(.*?)</a>#i', '\1', $d); //print_r($tag2); $dat1= preg_match("~<a(?=[^>]* name=[\"']([^'\"]*)|)(\s+[^>]*)?>(.*?)</a>~", "$d"); if($tag1==$d || $tag2==$dat1 || $tag3==$d){ $post_data1= implode(" ",(array)$data1); $updateid=$row_s['update_id']; $account_name=$row_s['account_name']; $u_id=$row_s['user_id_u']; $author=$row_s['author']; $post_date=$row_s['time']; $title= stripslashes($row_s['title']); $data= stripslashes($row_s['update_body']); $data1= hashtags($post_data1); // $data1= taggingsys($data0); $pic=$project->viewByUname($author); $uid=$pic['user_id']; $datemade = strftime("%B %d, %y", strtotime($post_date)); $avatar=$pic['avatar']; if ($avatar!=""){ $feed_pic='../user/user/'.$uid.'/'.$avatar; } else { $feed_pic='img/avatardefault.png'; } $vote_up_count=$project->voteUpdateCheck($updateid, $_SESSION['id']); if($vote_up_count[0][0]>0){ $vote_like=TRUE; } else { $vote_like=FALSE; } if($vote_up_count[0][1]>0){ $vote_dislike=TRUE; } else { $vote_dislike=FALSE; } include 'ratings/vote_count.php'; if ( $vote_like==TRUE && $vote_dislike==FALSE) { $like='<a type="like" class="btn liked status_like_'.$updateid.' like" attr="'.$updateid.'">Liked</a>('.$num_likes[0].')'; $unlike='<a type="unlike" class="btn status_unlike_'.$updateid.' unlike" attr="'.$updateid.'">Dislike</a>('.$num_unlikes[0].')'; } elseif ($vote_dislike==TRUE && $vote_like==FALSE) { $like='<a type="like" class="btn status_like_'.$updateid.' like" attr="'.$updateid.'">Like</a>('.$num_likes[0].')'; $unlike='<a type="unlike" class="btn disliked status_unlike_'.$updateid.'" attr="'.$updateid.'">Disliked</a>('.$num_unlikes[0].')'; } else { $like='<a type="like" class="btn status_like_'.$updateid.' like" attr="'.$updateid.'">Like</a>('.$num_likes[0].')'; $unlike='<a type="unlike" class="btn status_unlike_'.$updateid.' unlike" attr="'.$updateid.'">Dislike</a>('.$num_unlikes[0].')'; } $share_button=""; $hidden_text= '<textarea class="hidden_textarea hidden_value'.$updateid.'" type="hidden" disabled>'.$data1.'</textarea>'; $share_button="<a class='btn share_btn share_".$updateid."' title='".$title."' type='share' id='".$updateid."'>Share</a>"; if ($author==$_SESSION['uname'] || $account_name==$_SESSION['uname']) { $statusdeletebutton='<li>' . '<a type="'.$updateid.'" class="btn delete_4_session hidden_text_delete_'.$updateid.' glyphicon glyphicon-trash delete_status_btn" title="Delete this status and its replies">Remove</a></li>'; $edit_btn='<li>' . '<a attr="'.$updateid.'" type="'.$updateid.'" class="btn edit_4_session hidden_text_edit glyphicon glyphicon-pencil" title="Edit this status" >Edit</a></li>'; $statusui_edit="<div type='".$updateid."' class='hidden_edit_4_session session_editor".$updateid." jumbotron'>" . "<a type='".$updateid."' class='btn pull-right close_edit' title='Close without editing'>Close X</a>" . "<input type='text' class='form-control title_s_edit title_s_".$updateid."' name='status_title' value='".html_entity_decode($title)."' placeholder='Title' >" . "<span> </span>" . "<textarea id='wall_edit_".$updateid."' type='".$updateid."' rows='5' cols='50' class='session_edit text_value_".$updateid."' wrap='hard' placeholder='whats up ".$session_uname."'> ".html_entity_decode($data1)."</textarea><br>" . "<button style='float:right;' value='".$updateid."' type='a' class='btn btn-warning btn btn-large btn-lg post-s-edit'>Update</button></div>" ; }else{ $statusdeletebutton=""; $edit_btn="<li class='posted'>You are not the owner of this Post</li>"; $statusui_edit=""; } echo $statusui_edit.''. $hidden_text.'<div attr="'.$updateid.'" type="'.$updateid.'" class="statusboxes status_'.$updateid.' jumbotron">' . '<h3 class="pull-left title">' . '<div id="'.$updateid.'" class="title_s_2copy posted" value="'.html_entity_decode($title).'">'.html_entity_decode($title).'</div></h3>' . '<span class="pull-right">' . '<div class="dropdown">' . '<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" >' . '<span class="glyphicon glyphicon-edit"></span></button>' . '<ul class="dropdown-menu">' .$edit_btn .' '. $statusdeletebutton .'</ul></div></span><br><hr>' . '<legend><span style="font-size: 13.5px;" class=" data_s_2copy" type="'.$updateid.'" >' . html_entity_decode($data1).'</span></legend><b class="posted"><small>Posted by:- <a href="home.php?u='.$author.'"><img src="'.$feed_pic.'" height="20px" width="20px"> '.$author. '</a> '.$datemade.'</small></b>' . '<br><legend>'.$like.' | '.$unlike. ' | '.$share_button.'<h4><a id="'.$updateid.'" class="btn collap-btn">Comments</a></h4></legend>'; ?> <!-- Collapsible Element HTML --> <?php // Fetch Comments of update echo '<div id="toggle'.$updateid.'" class="collapse">'; $totalComments=$project->totalComments($_SESSION['uname'],$friend,$updateid); foreach($totalComments as $row1){ $status_reply_id=$row1['comment_id']; $reply_d=htmlentities($row1['comment_body']); $reply_data= stripslashes($reply_d); $reply_osid=$row1['os_id']; $reply_date=$row1['time_c']; $reply_author=$row1['author_c']; $reply_data1= hashtags($reply_data); // $reply_data1= taggingsys($reply_data0); $datemade_r = strftime("%B %d, %y", strtotime($reply_date)); include 'ratings/vote_count4comments.php'; $vote_up_count_r=$project->voteReplyCheck($_SESSION['id'], $status_reply_id); if($vote_up_count_r[0][0]>0){ $vote_like_r=TRUE; } else { $vote_like_r=FALSE; } if($vote_up_count_r[0][1]>0){ $vote_dislike_r=TRUE; } else { $vote_dislike_r=FALSE; } if ( $vote_like_r==TRUE && $vote_dislike_r==FALSE) { $like_r='<a type="like" class="btn status_liker_'.$status_reply_id.' liked_r" attr="'.$status_reply_id.'">Liked</a>('.$num_likes_r[0].')'; $unlike_r='<a type="unlike" class="btn status_unliker_'.$status_reply_id.' unlike_r" attr="'.$status_reply_id.'">Dislike</a>('.$num_unlikes_r[0].')'; } elseif ($vote_dislike_r==TRUE && $vote_like_r==FALSE) { $like_r='<a type="like" class="btn status_liker_'.$status_reply_id.' like_r" attr="'.$status_reply_id.'">Like</a>('.$num_likes_r[0].')'; $unlike_r='<a type="unlike" class="btn status_unliker_'.$status_reply_id.' disliked_r" attr="'.$status_reply_id.'">Disliked</a>('.$num_unlikes_r[0].')'; } else { $like_r='<a type="like" class="btn status_liker_'.$status_reply_id.' like_r" attr="'.$status_reply_id.'">Like</a>('.$num_likes_r[0].')'; $unlike_r='<a type="unlike" class="btn status_unliker_'.$status_reply_id.' unlike_r" attr="'.$status_reply_id.'">Dislike</a>('.$num_unlikes_r[0].')'; } $pic=$project->viewByUname($reply_author); $uid=$pic['user_id']; $avatar=$pic['avatar']; if ($avatar!=""){ $feed_r_pic='../user/user/'.$uid.'/'.$avatar; } else { $feed_r_pic='img/avatardefault.png'; } if ($reply_author==$_SESSION['uname'] ) { $reply_delete_button='<li><a type="'.$status_reply_id.'" class="btn delete_reply_btn glyphicon glyphicon-trash delete_reply_"'.$status_reply_id.'" title="Delete this comment"> Remove</a></span></li>'; } else{ $reply_delete_button=""; } echo ' <div class="replyboxes pull-left reply_' .$status_reply_id.'">' . 'Reply by:- ' . '<a href="home.php?u='.$reply_author. '"><img src="'.$feed_r_pic.'" height="20px" width="20px">'.$reply_author.'</a>' . '<span class="pull-right">'.$datemade_r . '<b class="dropdown"> <small><span class="btn btn-xs btn-danger dropdown-toggle pull-right" data-toggle="dropdown" > <span class="glyphicon glyphicon-edit"></span></span> <ul class="dropdown-menu">'.$reply_delete_button . '</ul></span>' . '</small></b><br><legend>'. html_entity_decode($reply_data1).'<br>'.$like_r.'|'.$unlike_r.'</legend></div>'; } echo '<textarea id="reply_textarea_'.$updateid.'" class="status_reply_'.$updateid.' input-custom2" placeholder="comment\'s"></textarea>' . '<button id="reply_butn_'.$updateid.'" attr="'.$updateid.'" type="b" class="btn btn-warning pull-right btn-sm reply_butn reply_'.$updateid.'">Reply</button></div></div>'; } } } echo "</div></td><td class='div-col-right1 '><div class='overflow'><h3>Groups</h3>"; foreach ($data_fetch as $row_d) { $dat= html_entity_decode($row_d['data']); $dat1= explode(" ", $dat); $tag1="!$tag"; foreach($dat1 as $d){ //$dat1= preg_match("$tag1", "$d"); if($tag1==$d){ $post_data1=implode(" ", $dat1); $postid=$row_d['gp_id']; $post_auth=$row_d['author_gp']; $post_type=$row_d['type']; $post_title= html_entity_decode($row_d['title']); $post_data= html_entity_decode($row_d['data']); $data1= hashtags($post_data); // $data11= hashtags1($post_data,$tag); $post_date=$row_d['pdate']; $post_avatar=$row_d['avatar']; $post_uid=$row_d['user_id_g']; if ($post_avatar != ""){ $g_pic='../user/user/'.$post_uid.'/'.$post_avatar; } else { $g_pic='img/avatardefault.png'; } $user_image="<img src='{$g_pic}' alt='{$post_auth}' title='{$post_auth}' width='30' height='30'>"; $vote_up_count=$project->voteGroupCheck($postid, $_SESSION['id']); if($vote_up_count[0][0]>0){ $vote_like=TRUE; } else { $vote_like=FALSE; } if($vote_up_count[0][1]>0){ $vote_dislike=TRUE; } else { $vote_dislike=FALSE; } include 'ratings/vote_count_g.php'; if ( $vote_like==TRUE && $vote_dislike==FALSE) { $like='<a type="liked" class="btn liked status_like_'.$postid.' liked" attr="'.$postid.'">Liked</a>('.$num_likes[0].')'; $unlike='<a type="unlike" class="btn status_unlike_'.$postid.' unlike" attr="'.$postid.'">Dislike</a>('.$num_unlikes[0].')'; } elseif ($vote_dislike==TRUE && $vote_like==FALSE) { $like='<a type="like" class="btn status_like_'.$postid.' like" attr="'.$postid.'">Like</a>('.$num_likes[0].')'; $unlike='<a type="disliked" class="btn disliked status_unlike_'.$postid.'" attr="'.$postid.'">Disliked</a>('.$num_unlikes[0].')'; } else { $like='<a type="like" class="btn status_like_'.$postid.' like" attr="'.$postid.'">Like</a>('.$num_likes[0].')'; $unlike='<a type="unlike" class="btn status_unlike_'.$postid.' unlike" attr="'.$postid.'">Dislike</a>('.$num_unlikes[0].')'; } #build threads. echo "<div id='PB_".$postid."' value='".$postid."' class='jumbotron'><span id='spinner".$postid."'></span>" . "<legend>{$post_title}" . "<span class='pull-right'>" . "<div class='dropdown'>" . "<button type='button' class='btn btn-danger dropdown-toggle' data-toggle='dropdown' >" . "<span class='glyphicon glyphicon-edit'></span></button>" . "<ul class='dropdown-menu'>" ."</ul></div></span><br></legend>" . "<legend>{$data1}<br><span class='spinner_g_u{$postid}'></span>{$like} | {$unlike} <br>Posted by:<a target='_blank' href='home.php?u={$post_auth}&v={$_SESSION['uname']}'>{$user_image} {$post_auth}</a>-- {$post_date}<hr><br></legend> <h4><a id='{$postid}' class='btn collap-btn'>Comments</a></h4><div class='collapse scroll-comments' id='toggle{$postid}'>"; #get replies and user image using inner loop $num_rows1=$project->groupcount_replies($postid); $fetch1=$project->group_replies($postid); if ($num_rows1>0) { foreach ($fetch1 as $row1) { $reply_id=$row1['gp_id']; $reply_pid=$row1['pid']; $reply_auth=$row1['author_gp']; $reply_data=$row1['data']; $data11= hashtags($reply_data); $data12= $data11; $reply_date=$row1['pdate']; $reply_avatar=$row1['avatar']; $reply_uid=$row1['user_id']; if ($reply_avatar != ""){ $r_pic='../user/user/'.$reply_uid.'/'.$reply_avatar; } else { $r_pic='img/avatardefault.png'; } /* include 'ratings/vote_count_g4comments.php'; $like_r='<a type="like" class="btn status_liker_'.$reply_id.' like_r" attr="'.$reply_id.'">Like</a>('.$num_likes_r[0].')'; $unlike_r='<a type="unlike" class="btn status_unliker_'.$reply_id.' unlike_r" attr="'.$reply_id.'">Dislike</a>('.$num_unlikes_r[0].')'; */ $vote_up_count=$project->voteGroupReplyCheck($_SESSION['id'],$reply_id); if($vote_up_count[0][0]>0){ $vote_like=TRUE; } else { $vote_like=FALSE; } if($vote_up_count[0][1]>0){ $vote_dislike=TRUE; } else { $vote_dislike=FALSE; } include 'ratings/vote_count_g4comments.php'; if ( $vote_like==TRUE && $vote_dislike==FALSE) { $like_r='<a type="liked" class="btn status_liker_'.$reply_id.' liked_r" attr="'.$reply_id.'">Liked</a>('.$num_likes_r[0].')'; $unlike_r='<a type="unlike" class="btn status_unliker_'.$reply_id.' unlike_r" attr="'.$reply_id.'">Dislike</a>('.$num_unlikes_r[0].')'; } elseif ($vote_dislike==TRUE && $vote_like==FALSE) { $like_r='<a type="like" class="btn status_liker_'.$reply_id.' like_r" attr="'.$reply_id.'">Like</a>('.$num_likes_r[0].')'; $unlike_r='<a type="unliked" class="btn disliked_r status_unliker_'.$reply_id.'" attr="'.$reply_id.'">Disliked</a>('.$num_unlikes_r[0].')'; } else { $like_r='<a type="like" class="btn status_liker_'.$reply_id.' like_r" attr="'.$reply_id.'">Like</a>('.$num_likes_r[0].')'; $unlike_r='<a type="unlike" class="btn status_unliker_'.$reply_id.' unlike_r" attr="'.$reply_id.'">Dislike</a>('.$num_unlikes_r[0].')'; } $reply_img="<img src='{$r_pic}' alt='{$reply_auth}' title='{$reply_auth}' width='15' height='15'>"; #build replies echo "<div id='reply_body'>" . "<small>Posted by:{$reply_img} {$reply_auth}-- {$reply_date}</small><br>" . "<legend>{$data12}<br><span class='spinner_g_r{$reply_id}'></span>{$like_r} | {$unlike_r} </legend></div>"; } } echo '<br>' . '<textarea id="reply_textarea_'.$postid.'" class="group_reply1 input-custom2" placeholder="comment\'s"></textarea>' . '<br><span class="group_reply"></span><button action="post_reply" id="'.$postid.'" attr="'.$postid.'" type="b" class="btn btn-warning pull-right btn-sm reply_btn reply">Reply</button><br></div></div>'; } } } } echo '</div></td>'; ?> </div> <div class="col-sm-2" style="float: right;"> <?php include 'notification/friend_suggestion.php';?> </div> </div> </div> here is the full code and a sampple mysql fiddle:http://sqlfiddle.com/#!9/32149a/1
  11. narutofan

    If statement not working after loop

    sorry it was a typo its $tag_fetch=$stmt_t->fetchAll();
  12. narutofan

    If statement not working after loop

    the $tag_fetch=$stmt_1->fetchAll(); comes above hashtags function and it contains values from updates table
  13. Hi, i’m trying to get html output from a loop. The problem is i get results up untill the loop, but i’m not getting the results to be embedded in html after the if statement the $d and $tag1 are not printing when i tried print_r. the code is to get tag value from url and then they are exploded and compared with the $tag1 variable it prints well untill the loop but when it reaches the if st i don’t know what goes wrong in my code it isn’t outputting anything after that $tag= htmlentities($_GET['tag']); $sql3="select * from updates"; $stmt_t=$conn->prepare($sql3); $stmt_t->execute(); function hashtags($dat) { $regex="/!+([a-zA-z0-9._-]+)/"; $dat1= preg_replace($regex, '<a href="hash_sys.php?tag=$1">$0</a>', $dat); return $dat1; } foreach ($tag_fetch as $row_s) { $data= htmlentities($row_s['update_body']); $data1= explode(" ", $data); foreach($data1 as $d){ $tag1="!".$tag; //$dat1= preg_match("$tag1", "$d"); if($d==$tag1){ $post_data1=implode(" ", $data1); print_r($post_data1); $updateid=$row_s['update_id']; < html content that is embedded with loop results... > }
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.