Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:26:49+00:00 2026-05-26T13:26:49+00:00

I am learning to work with PHP and have a simple problem. <?php ini_set(‘display_errors’,

  • 0

I am learning to work with PHP and have a simple problem.

<?php
   ini_set('display_errors', 'On');
  error_reporting(E_ALL);
  $db = new PDO('sqlite:/usr/users2/mieic2009/ei09072/public_html/TP1/Delicious    /Database.db');
   $a = $_GET['linkRef'];
   $b = $_GET['tagToAdd'];

   $checkIdLink = $db->prepare('SELECT idLink FROM Links WHERE nome_L = :link_n;');
   $checkIdLink->bindParam(':link_n', $a, PDO::PARAM_STR);
   $checkIdLink->execute();
   $linkID = $checkIdLink->fetch();

   $insertLink = $db->prepare('INSERT INTO Tags (nome_T, idLink) VALUES (:addTag, :link_id)');
   $insertLink->bindParam(':addTag', $b, PDO::PARAM_STR);
   $insertLink->bindParam(':link_id', $linkID, PDO::PARAM_INT);
   $insertLink->execute();

    echo 'Tag added to the specified link!';
?>

This code should add a Tag to an existing link in a database, however I am getting this error

Fatal error: Call to a member function bindParam() on a non-object in
/usr/users2/mieic2009/ei09072/public_html/TP1/Delicious/addTag.php on
line 9

I have checked over and over and can’t seem to find what’s wrong with this code, I googled for this error but unfortunately the answer I found weren’t helpful enough. Any help would be appreciated, this is probably a simple rookie mistake.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:26:50+00:00Added an answer on May 26, 2026 at 1:26 pm

    I would check that the $db->prepare() function executed successfully. It will return false if it did not. So you could be trying to call bindParam() on a variable that equals false

    http://www.php.net/manual/en/pdo.prepare.php

    Also you should put the PDO object declaration in try/catch to be sure it was successful as well, as in the first example on this page:

    try {
        $dbh = new PDO($dsn, $user, $password);
    } catch (PDOException $e) {
        echo 'Connection failed: ' . $e->getMessage();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a student learning PHP. I basically make the stuff work, but never wondered
I'm learning about VB.Net and need to work with an SQLite database using the
All of us who work with relational databases have learned (or are learning) that
I have a very simple test script: <?php $DSN = "mysql:host=db.example.edu;port=3306;dbname=search_data"; try { $DB
I have just started learning PHP, and here's my first doubt... Both of these
I am new to web development and I'm learning PHP in order to sell
I'm learning JSP and have a good working knowledge of PHP and MVC frameworks.
im learning php and to keep it simple (i think), this is what im
Im fairly proficient in php and am also learning python. I have been wanting
I just started learning Zend (& OO PHP for that matter), I have spent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.