Jump to content

Search the Community

Showing results for tags 'pdo'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. So I am working with a script that allows load more scrolling, much like youtube's comments section. The script I found uses mysqli and I am using PDO. So I need a bit of help converting some code below. Origional mysqli $results = mysqli_query($connecDB,"SELECT COUNT(*) FROM paginate"); $get_total_rows = mysqli_fetch_array($results); //total records //break total records into pages $total_pages = ceil($get_total_rows[0]/$item_per_page); My PDO code $results = DB::getInstance()->query("SELECT COUNT(*) FROM guestbook"); $get_total_rows = $results->results(); //break total records into pages $total_pages = ceil($get_total_rows[0]/$item_per_page); With the code above, I get the following error. "Object of class stdClass could not be converted to int"
  2. Someone gave me a script that works - but it doesn't work for me. I've been trying to debug it, but I'm striking out. First, let's start with a simple query: $sql= "SELECT COUNT(URL) AS num FROM people WHERE URL = :MyURL"; It works, where a URL is MySite/Carl_Sagan and $MyURL = 'Carl_Sagan' I have several similar queries for various websites and sections. I want to try to merge everything into a new website that will function kind of like a mini encyclopedia. So I use UNION ALL to link several queries together, like this... $sql = "SELECT SUM(num) FROM ( SELECT COUNT(URL) AS num FROM pox_topics WHERE URL = :MyURL UNION ALL SELECT COUNT(URL) AS num FROM people WHERE URL = :MyURL UNION ALL SELECT COUNT(Taxon) AS num FROM gz_life WHERE Taxon = :MyURL ) AS X"; $stmt = $pdo->prepare($sql); $stmt->bindParam(':MyUrl',$MyURL,PDO::PARAM_STR); $stmt->execute(); $Total = $stmt->fetch(); switch($Total['num']) { case 1: // ETC.
×
×
  • 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.