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

  • Home
  • SEARCH
  • 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 8545993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:55:01+00:00 2026-06-11T12:55:01+00:00

I am new to PhP. I am trying to delete some rows from my

  • 0

I am new to PhP. I am trying to delete some rows from my sqlite database, but I can’t figure out what is wrong. My code is as below:

<?php
    $app_name=array("TestApp", "MyDataBase");
    $dir = 'sqlite:/home/ravi/public_html/GcmServer/FavoriteApps.db';
    $dbh= new PDO($dir) or die("cannot open the database");
    for($i=0;$i<sizeof($app_name);$i++) {
        error_log("looop start here...............");
        error_log("FirstAppName ".$app_name[$i]);
        $result=  $dbh->Query("DELETE FROM favorite_apps WHERE appname = '$app_name[$i]'") or die( error_log("error".mysql_error() ));
        error_log("looop execute here...............");
    }
?>

And my log file is like this:

[Wed Sep 19 11:16:38 2012] [error] [client 127.0.0.1] looop start    here...............
[Wed Sep 19 11:16:38 2012] [error] [client 127.0.0.1] FirstAppName TestApp
[Wed Sep 19 11:16:38 2012] [error] [client 127.0.0.1] error

and my localhost show 1,
thanks.

  • 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-06-11T12:55:02+00:00Added an answer on June 11, 2026 at 12:55 pm

    You are using mysql_error() function but your database is sqlite and you are using PDO, where error handling is quite different. Try to encapsulate your code into try-catch block to see more info:

    <?php
      $app_name=array("TestApp", "MyDataBase");
      $dir = 'sqlite:/home/ravi/public_html/GcmServer/FavoriteApps.db';
      $dbh= new PDO($dir) or die("cannot open the database");
      try {
        for($i=0;$i<sizeof($app_name);$i++) {
          error_log("looop start here...............");
          error_log("FirstAppName ".$app_name[$i]);
          $dbh->Query("DELETE FROM favorite_apps WHERE appname = '$app_name[$i]'");
          error_log("looop execute here...............");
        }
      } catch (PDOException $e) {
        echo $e->getMessage();
      }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to PHP but come from a Java background and I'm trying to
I am new to PHP and trying to learn it by creating a database
I'm new to php and using APC framework. I'm trying to write some unit
I am new to PHP and trying to get the following code to work:
I'm trying to figure out how to hide a text box using php coding.
I am new to php and trying to write a login function. Bit stuck
I'm new to PHP and trying to get my head around security. I have
I am trying to use a PHP form (new.php) to update 2 MySQL tables
I am new to PHP and was trying to build RestFull service in PHP
I'm new to php and I'm trying to create a simple example for calling

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.