Jump to content

lovephp

Members
  • Content Count

    530
  • Joined

  • Last visited

Community Reputation

1 Neutral

About lovephp

  • Rank
    Prolific Member
  1. typos in title i mean phpfreaks
  2. was wondering how many years its been online?
  3. oh god my mistake i should have made this $results= $sth->fetchall(PDO::FETCH_ASSOC); not $rows = $sth->fetchall(PDO::FETCH_ASSOC); now fixed
  4. i also tried BindParam but same no records gets fetched
  5. ok this time serious not guessing i have got rest of it working but running into something which i guess you guys will know better than me for sure i am getting results if i query it like $results = $db->query('SELECT * FROM blog_posts WHERE catID = '.$cat.' ORDER BY postID DESC LIMIT '.$row.','.$records_per_page.'')->fetchAll(); but when i use $cat = $_POST['catid']; $row = $_POST['row']; global $records_per_page; $sth = $db->prepare("SELECT * from blog_posts WHERE catID = ? ORDER BY postID ASC LIMIT ?,?"); $sth->execute(array($cat,$row,$rowperpage)); $sth->exec
  6. i did this $query = "SELECT count(id) AS allcount FROM posts WHERE cat :cat"; $stmt->bindParam(':cat', $catid, PDO::PARAM_INT); $stmt->execute(); $allcount = $db->query($query)->fetchColumn(); $qry = "SELECT * FROM posts WHERE cat :cat ORDER BY id ASC LIMIT LIMIT :rowperpage OFFSET :offset"; $stm = $db->prepare($qry); $stm->bindParam(':cat', $catid, PDO::PARAM_INT); $stm->bindParam(':rowperpage', $rowperpage, PDO::PARAM_INT); $stm->bindParam(':offset', $offset, PDO::PARAM_INT); $stm->execute(); $results = $stm->fetchall(PDO::FETCH_ASSOC); and i get
  7. i get it like this LIMIT :rowperpage OFFSET :offset ?
  8. hehehe guess-what-my-problem-is game i get u soi do bind to all but offset and perpage limit how am i to bind them? $query = "SELECT count(id) AS allcount FROM posts WHERE cat = :cat"; $stmt->bindParam(':catUrl', $url, PDO::PARAM_INT); $stmt->execute(); $allcount = $db->query($query)->fetchColumn(); $qry = "SELECT * FROM posts WHERE cat = :cat ORDER BY id ASC LIMIT ?,? "; $stm = $db->prepare($qry); $stm->execute(array($offset,$rowperpage)); $results = $stm->fetchall(PDO::FETCH_ASSOC);
  9. whatis is the procedure to add the where clause to this query? i need to display where catid = 1; $catid = 1; $rowperpage = 3; $offset = 0; $query = "SELECT count(id) AS allcount FROM posts"; $allcount = $db->query($query)->fetchColumn(); $qry = "SELECT * FROM posts ORDER BY id ASC LIMIT ?,? "; $stm = $db->prepare($qry); $stm->execute(array($offset,$rowperpage)); $results = $stm->fetchall(PDO::FETCH_ASSOC); do i have to add $catid = 1; $rowperpage = 3; $offset = 0; $query = "SELECT count(id) AS allcount FROM posts WHERE cat = :cat"; $stmt->bindParam('
  10. It is creating <a href="http://localhost//blogg/category/X/page/N"> but the yes if click it redricts to index.php
  11. this is how it looks now but still not working $pagination = ""; if($last_page > 1){ $pagination .= "<div class='pagination'>"; if($page > 1) $pagination.= "<a href='$pageName/page/1'>« First</a>"; else $pagination.= "<span class='disabled'>« First</span>"; if ($page > 1) $pagination.= "<a href='$pageName/page/".$prev."'>« Previous </a>"; else $pagination.= "<span class='disabled'>« Previous </span>"; if (
×
×
  • Create New...

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.