Php 你将来不会有问题。这是一个你不想忘记的责任,正确地做这件事只需要多写几行代码。当您试图追踪因转义问题而丢失的字符时,这将为您节省无休止的调试时间。这个问题中还有太多的代码。你需要把这个问题归结为一个最小的例子,这样其他人就可以解决它。好吧,伙计,我明白你的

Php 你将来不会有问题。这是一个你不想忘记的责任,正确地做这件事只需要多写几行代码。当您试图追踪因转义问题而丢失的字符时,这将为您节省无休止的调试时间。这个问题中还有太多的代码。你需要把这个问题归结为一个最小的例子,这样其他人就可以解决它。好吧,伙计,我明白你的,php,mysql,pagination,hashtag,Php,Mysql,Pagination,Hashtag,你将来不会有问题。这是一个你不想忘记的责任,正确地做这件事只需要多写几行代码。当您试图追踪因转义问题而丢失的字符时,这将为您节省无休止的调试时间。这个问题中还有太多的代码。你需要把这个问题归结为一个最小的例子,这样其他人就可以解决它。好吧,伙计,我明白你的意思,你是对的,我现在就来解决,但我也问了一些问题。。。。 $stmt = $con->prepare("SELECT id, titlu, link, poza, alt, keywords, linknews FROM stiint


你将来不会有问题。这是一个你不想忘记的责任,正确地做这件事只需要多写几行代码。当您试图追踪因转义问题而丢失的字符时,这将为您节省无休止的调试时间。这个问题中还有太多的代码。你需要把这个问题归结为一个最小的例子,这样其他人就可以解决它。好吧,伙计,我明白你的意思,你是对的,我现在就来解决,但我也问了一些问题。。。。
$stmt = $con->prepare("SELECT id, titlu, link, poza, alt, keywords, 
linknews FROM stiinta WHERE   approved='1' AND  replace(replace(replace(keywords, ',', ''), '-', ''), ' ', '') LIKE  '%$keyword%' UNION SELECT id, titlu, link, poza, alt, keywords, linknews FROM travel WHERE   approved='1' AND  replace(replace(replace(keywords, ',', ''), '-', ''), ' ', '') LIKE  '%$keyword%' UNION SELECT id, titlu, link, poza, alt, keywords, linknews FROM stiinta WHERE   approved='1' AND  replace(replace(replace(keywords, ',', ''), '-', ''), ' ', '') LIKE  '%$keyword%' UNION SELECT id, titlu, link, poza, alt, keywords, linknews FROM natura WHERE   approved='1' AND  replace(replace(replace(keywords, ',', ''), '-', ''), ' ', '') LIKE  '%$keyword%' UNION SELECT id, titlu, link, poza, alt, keywords, linknews FROM lifestyle WHERE   approved='1' AND  replace(replace(replace(keywords, ',', ''), '-', ''), ' ', '') LIKE  '%$keyword%' LIMIT 3");
$stmt->execute();
$stmt->bind_result($id, $titluKEY, $linkKEY, $pozaKEY, $altKEY, $keywordKEY, $linknewsKEY);//variabla pe care o vrei inlocuita prin bind_Result in loc de get_Result
$stiintalist = '';
while ($stmt->fetch())    {
    $id;
    $titluKEY;
    $linkKEY;
    $pozaKEY;
    $altKEY; 
    $keywordKEY;
    $linknewsKEY;   // faci acelasi lucru fara $row trb sa fie in concordanta cu ceea ce este in SELECT column pentretu teste a href="/page-stiinta.php?pid='.$linkKEY.'"
    $stiintalist .= '<div id="articol-content-more"><a href="/'.$linknewsKEY.'"><img src="/images/'.$pozaKEY.'.jpg"class="articol-content-more-image" alt="'.$altKEY.'"><p class="articol-content-more-title">'.$titluKEY.'</p></a><span><a class="articol-content-more-afla" href="/'.$linknewsKEY.'">Citește mai multe</a></span><span class="articol-content-more-fl"><div class="fb-share-button" data-layout="button_count" data-href="http://esticurios.ro/'.$linknewsKEY.'"></div></span></div>';        
echo $stiintalist;//the results doesnot show any query even if i have others records with the some value from the column (keywords)
    }
function convertHashtags($str){
       $regex = "/#+([0-9a-zA-Z_-]+)/";
       $str = preg_replace($regex, '<a id="tags" href="../etichete.php?tag=$1">$0</a>', $str);//id="tags" CSS custome
       return($str);
       }
   $string = $keyword;
   $string = convertHashtags($string);
   echo $string; 
if(isset($_GET['tag'])){
    $tag = preg_replace('#[^a-z0-9_]#i', '', $_GET['tag']);#+([0-9a-zA-Z_-]+)/ [^a-z0-9_]
    // $tag is now santized and ready for database queries here
    $fulltag = "<h3>Articole despre ".$tag."</h3><br>";
    echo $fulltag;

// this first query is just to get the
$sql = "SELECT COUNT(id) FROM istorie WHERE approved='1'  UNION  SELECT COUNT(id) FROM lifestyle WHERE approved='1'  UNION  SELECT COUNT(id) FROM stiinta WHERE approved='1' UNION  SELECT COUNT(id) FROM travel WHERE approved='1' UNION  SELECT COUNT(id) FROM natura WHERE approved='1'";
$query = mysqli_query($db_conx_tag, $sql);
$row = mysqli_fetch_row($query);
//here we have the total row count
$rows = $row[0];
// this is the number of results we want displayed per page cate query(interogari) sa afisieze pe pagina
$page_rows = 10;
// this tells us the page number of our last page
$last = ceil($rows/$page_rows);
// this makes sure $last cannot be less than 1
if($last < 1){
    $last = 1;
}
//establishes the $pagenumb variable
$pagenum = 1;
//get pagenumber from url vars if is present, else it is = 1
if(!empty($_GET['pn'])){
    $pagenum = preg_replace('#[^0-9]#', '',  $_GET['pn']);
}
// this makes sure the page number isn't below 1 or more than our $last page
if ($pagenum < 1) {
    $pagenum = 1;
} else if ($pagenum > $last) {
    $pagenum = $last;
}
// this set the range of rows to query for the chosen $pagenum
$limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows;
// this is your query again is t -- ce sa fie in tabel si dupa ce fie ales daca e dupa data sau dupa id.. modific si obtin cum
    $sql = "SELECT id, titlu, descriere, data, linknews, poza, alt FROM istorie WHERE titlu  LIKE '%$tag%' UNION SELECT id, titlu, descriere, data, linknews, poza, alt FROM lifestyle WHERE titlu LIKE '%$tag%' UNION SELECT id, titlu, descriere, data, linknews, poza, alt FROM natura WHERE titlu LIKE '%$tag%' UNION SELECT id, titlu, descriere, data, linknews, poza, alt FROM travel WHERE titlu LIKE '%$tag%' UNION SELECT id, titlu, descriere, data, linknews, poza, alt FROM stiinta WHERE titlu LIKE '%$tag%' ORDER BY data DESC $limit";
    $query = mysqli_query($db_conx_tag, $sql); 
    echo mysqli_error($db_conx_tag);
// this show the user what page they are on, and the total number of page
$textline1 = "Număr total de articole (<b>$rows</b>)";
$textline2 = "Pagina a <b>$pagenum</b> din <b>$last</b>";
// establish the $paginationCtrls variabls
$paginationCtrls = '';
// if the is more than 1 worth of resurls
if($last != 1){
    /* first we check if we are on page one. if we are then we don't need a link to the previous page or the first page so we do nothing, if we aren't then we generate links to the first page and to the previous page. */
    if ($pagenum > 1) {
        $previous = $pagenum - 1;
        $paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?tag='.$tag.'&amp;pn='.$previous.'">Anteriora</a> &nbsp; &nbsp; ';
        // render clickable number links that should apeer on adica ce arata ca pagina daca e pe 6 e-4 deci arata 3
        for($i = $pagenum-3; $i < $pagenum; $i++){
            if($i > 0){
                $paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?tag='.$tag.'&amp;pn='.$i.'">'.$i.'</a> &nbsp; ';
            }
        }
    }
    // render the target page number, but without it beging
    $paginationCtrls .= ''.$pagenum.' &nbsp; ';
    // render clicktable number links that should apeer on the right daca e pe 9 sa nu ii arata si sunt doar 10 pagini in total sa iia rate 12 si asa mai departe
    for($i = $pagenum+1; $i <= $last; $i++){
        $paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?tag='.$tag.'&amp;pn='.$i.'">'.$i.'</a> &nbsp; ';
        if($i >=$pagenum+4){
            break;
        }
    }
    // la fel ca mai sus la randul 42 cu previous
    if ($pagenum > 1) {
        $next = $pagenum + 1;
        $paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?tag='.$tag.'&amp;pn='.$next.'">Urmatoarea</a> &nbsp; &nbsp; ';
        // render clickable number links that should apeer on adica ce arata ca pagina daca e pe 6 e-4 deci arata 3
    }   
}
    $tagsearch = '';  
    while($row = mysqli_fetch_array($query)){
        $id = $row["id"];
        $titlu = $row["titlu"];
        $data = $row["data"];
        $linknews = $row["linknews"];
        $descriere = $row["descriere"];
        $poza = $row["poza"];
        $alt = $row["alt"];
        $tagsearch  .= '<div class="articol-small"><a href="/'.$linknews.'"><img src="/images/'.$poza.'.jpg"class="articol-small-image" alt="'.$alt.'"><h2 class="articol-title">'.$titlu.'</h2></a><div class="posted-date">'.$data.'</div><p class="articol-details">'.$descriere.'</p><a href="/'.$linknews.'" class="read-more">Citeste mai multe</a></div><br>';
    }
}