Can not insert data into SQLite3 database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Betikci Boris

    Can not insert data into SQLite3 database

    Can not insert data into SQLite3 database through browser however i
    can easily insert data into my db from konsole, in both attmpts i used
    php 5.2.6 on 2.6.25.* linux kernel

    i think there is a problem with my php setup but i could not find
    it...

    here is the code;
    ----------------------------------------------------------------------------------------
    $db = new PDO("sqlite:bar .db");
    $sql = "select * from user";

    $query = "insert into user values(null,'fo o','bar')";
    $db->query($query );
    print_r($db->query($query)) ;
    print_r($db->query($sql)) ;

    foreach ($db->query($sql) as $row)
    print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
    "<br>";

    unset($db);
    ------------------------------------------------------------------------------------------

    first print_r() function prints nothing, actually "select" works,
    "insert" wouldn't....

    What's the problem?
  • Jerry Stuckle

    #2
    Re: Can not insert data into SQLite3 database

    Betikci Boris wrote:
    Can not insert data into SQLite3 database through browser however i
    can easily insert data into my db from konsole, in both attmpts i used
    php 5.2.6 on 2.6.25.* linux kernel
    >
    i think there is a problem with my php setup but i could not find
    it...
    >
    here is the code;
    ----------------------------------------------------------------------------------------
    $db = new PDO("sqlite:bar .db");
    $sql = "select * from user";
    >
    $query = "insert into user values(null,'fo o','bar')";
    $db->query($query );
    print_r($db->query($query)) ;
    print_r($db->query($sql)) ;
    >
    foreach ($db->query($sql) as $row)
    print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
    "<br>";
    >
    unset($db);
    ------------------------------------------------------------------------------------------
    >
    first print_r() function prints nothing, actually "select" works,
    "insert" wouldn't....
    >
    What's the problem?
    >
    Enable all errors and display them - in your php.ini file, ensure you have:

    display_error=o n
    error_reporting =E_ALL


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Betikci Boris

      #3
      Re: Can not insert data into SQLite3 database

      On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      Betikci Boris wrote:
      Can not insert data into SQLite3 database through browser however i
      can easily insert data into my db from konsole, in both attmpts i used
      php 5.2.6 on 2.6.25.* linux kernel
      >
      i think there is a problem with my php setup but i could not find
      it...
      >
      here is the code;
      ----------------------------------------------------------------------------------------
      $db = new PDO("sqlite:bar .db");
      $sql = "select * from user";
      >
      $query = "insert into user values(null,'fo o','bar')";
      $db->query($query );
      print_r($db->query($query)) ;
      print_r($db->query($sql)) ;
      >
       foreach ($db->query($sql) as $row)
          print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
      "<br>";
      >
      unset($db);
      ------------------------------------------------------------------------------------------
      >
      first print_r() function prints nothing, actually "select" works,
      "insert" wouldn't....
      >
      What's the problem?
      >
      Enable all errors and display them - in your php.ini file, ensure you have:
      >
      display_error=o n
      error_reporting =E_ALL
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===
      i've tried with try catch but that's the point there is nothing to
      report.. According to this function =print_r($db->query($query)) ;
      query returns 0 or even -1,

      I think the problem with mod_php configuration on cli with php
      everything works fine ...

      Comment

      • Jerry Stuckle

        #4
        Re: Can not insert data into SQLite3 database

        Betikci Boris wrote:
        On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >Betikci Boris wrote:
        >>Can not insert data into SQLite3 database through browser however i
        >>can easily insert data into my db from konsole, in both attmpts i used
        >>php 5.2.6 on 2.6.25.* linux kernel
        >>i think there is a problem with my php setup but i could not find
        >>it...
        >>here is the code;
        >>----------------------------------------------------------------------------------------
        >>$db = new PDO("sqlite:bar .db");
        >>$sql = "select * from user";
        >>$query = "insert into user values(null,'fo o','bar')";
        >>$db->query($query );
        >>print_r($db->query($query)) ;
        >>print_r($db->query($sql)) ;
        >> foreach ($db->query($sql) as $row)
        >> print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
        >>"<br>";
        >>unset($db);
        >>------------------------------------------------------------------------------------------
        >>first print_r() function prints nothing, actually "select" works,
        >>"insert" wouldn't....
        >>What's the problem?
        >Enable all errors and display them - in your php.ini file, ensure you have:
        >>
        >display_error= on
        >error_reportin g=E_ALL
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        i've tried with try catch but that's the point there is nothing to
        report.. According to this function =print_r($db->query($query)) ;
        query returns 0 or even -1,
        >
        I think the problem with mod_php configuration on cli with php
        everything works fine ...
        >
        I didn't say use try and catch. Please try what I wrote.

        PHP base code doesn't generally throw exceptions. But it does provide
        error information if you have it configured to do so.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Betikci Boris

          #5
          Re: Can not insert data into SQLite3 database

          On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          Betikci Boris wrote:
          On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          Betikci Boris wrote:
          >Can not insert data into SQLite3 database through browser however i
          >can easily insert data into my db from konsole, in both attmpts i used
          >php 5.2.6 on 2.6.25.* linux kernel
          >i think there is a problem with my php setup but i could not find
          >it...
          >here is the code;
          >----------------------------------------------------------------------------------------
          >$db = new PDO("sqlite:bar .db");
          >$sql = "select * from user";
          >$query = "insert into user values(null,'fo o','bar')";
          >$db->query($query );
          >print_r($db->query($query)) ;
          >print_r($db->query($sql)) ;
          > foreach ($db->query($sql) as $row)
          >    print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
          >"<br>";
          >unset($db);
          >------------------------------------------------------------------------------------------
          >first print_r() function prints nothing, actually "select" works,
          >"insert" wouldn't....
          >What's the problem?
          Enable all errors and display them - in your php.ini file, ensure you have:
          >
          display_error=o n
          error_reporting =E_ALL
          >
          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstuck...@attgl obal.net
          =============== ===
          >
          i've tried with try catch but that's the point there is nothing  to
          report..  According to this function =print_r($db->query($query)) ;
          query returns 0 or even -1,
          >
          I think the problem with mod_php configuration on cli with php
          everything works fine ...
          >
          I didn't say use try and catch.  Please try what I wrote.
          >
          PHP base code doesn't generally throw exceptions.  But it does provide
          error information if you have it configured to do so.
          >
          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstuck...@attgl obal.net
          =============== ===
          In php.ini;

          display_error=o n
          error_reporting =E_ALL & ~E_NOTICE

          Comment

          • Jerry Stuckle

            #6
            Re: Can not insert data into SQLite3 database

            Betikci Boris wrote:
            On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            >Betikci Boris wrote:
            >>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            >>>Betikci Boris wrote:
            >>>>Can not insert data into SQLite3 database through browser however i
            >>>>can easily insert data into my db from konsole, in both attmpts i used
            >>>>php 5.2.6 on 2.6.25.* linux kernel
            >>>>i think there is a problem with my php setup but i could not find
            >>>>it...
            >>>>here is the code;
            >>>>----------------------------------------------------------------------------------------
            >>>>$db = new PDO("sqlite:bar .db");
            >>>>$sql = "select * from user";
            >>>>$query = "insert into user values(null,'fo o','bar')";
            >>>>$db->query($query );
            >>>>print_r($ db->query($query)) ;
            >>>>print_r($ db->query($sql)) ;
            >>>> foreach ($db->query($sql) as $row)
            >>>> print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
            >>>>"<br>";
            >>>>unset($db );
            >>>>------------------------------------------------------------------------------------------
            >>>>first print_r() function prints nothing, actually "select" works,
            >>>>"insert" wouldn't....
            >>>>What's the problem?
            >>>Enable all errors and display them - in your php.ini file, ensure you have:
            >>>display_erro r=on
            >>>error_report ing=E_ALL
            >>i've tried with try catch but that's the point there is nothing to
            >>report.. According to this function =print_r($db->query($query)) ;
            >>query returns 0 or even -1,
            >>I think the problem with mod_php configuration on cli with php
            >>everything works fine ...
            >I didn't say use try and catch. Please try what I wrote.
            >>
            >PHP base code doesn't generally throw exceptions. But it does provide
            >error information if you have it configured to do so.
            >>
            >
            In php.ini;
            >
            display_error=o n
            error_reporting =E_ALL & ~E_NOTICE
            >
            That still isn't what I asked you to put in your php.ini file!

            Do you always have this much trouble following a simple request?

            Sorry, I'm not in the habit of wasting my time. Find someone else to
            help you.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • Betikci Boris

              #7
              Re: Can not insert data into SQLite3 database

              On Aug 31, 5:04 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              Betikci Boris wrote:
              On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              Betikci Boris wrote:
              >On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              >>Betikci Boris wrote:
              >>>Can not insert data into SQLite3 database through browser however i
              >>>can easily insert data into my db from konsole, in both attmpts i used
              >>>php 5.2.6 on 2.6.25.* linux kernel
              >>>i think there is a problem with my php setup but i could not find
              >>>it...
              >>>here is the code;
              >>>----------------------------------------------------------------------------------------
              >>>$db = new PDO("sqlite:bar .db");
              >>>$sql = "select * from user";
              >>>$query = "insert into user values(null,'fo o','bar')";
              >>>$db->query($query );
              >>>print_r($d b->query($query)) ;
              >>>print_r($d b->query($sql)) ;
              >>> foreach ($db->query($sql) as $row)
              >>>    print $row['id'] . " " . $row['text'] . " " . $row['text2']

              Comment

              • Betikci Boris

                #8
                Re: Can not insert data into SQLite3 database

                On Sep 1, 12:08 pm, Betikci Boris <pard...@gmail. comwrote:
                On Aug 31, 5:04 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                >
                >
                >
                Betikci Boris wrote:
                On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                >Betikci Boris wrote:
                >>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                >>>Betikci Boris wrote:
                >>>>Can not insert data intoSQLite3data base through browser however i
                >>>>can easily insert data into my db from konsole, in both attmpts iused
                >>>>php 5.2.6 on 2.6.25.* linux kernel
                >>>>i think there is a problem with my php setup but i could not find
                >>>>it...
                >>>>here is the code;
                >>>>----------------------------------------------------------------------------------------
                >>>>$db = new PDO("sqlite:bar .db");
                >>>>$sql = "select * from user";
                >>>>$query = "insert into user values(null,'fo o','bar')";
                >>>>$db->query($query );
                >>>>print_r($ db->query($query)) ;
                >>>>print_r($ db->query($sql)) ;
                >>>> foreach ($db->query($sql) as $row)
                >>>>    print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
                >>>>"<br>";
                >>>>unset($db );
                >>>>------------------------------------------------------------------------------------------
                >>>>first print_r() function prints nothing, actually "select" works,
                >>>>"insert" wouldn't....
                >>>>What's the problem?
                >>>Enable all errors and display them - in your php.ini file, ensure you have:
                >>>display_erro r=on
                >>>error_report ing=E_ALL
                >>i've tried with try catch but that's the point there is nothing  to
                >>report..  According to this function =print_r($db->query($query)) ;
                >>query returns 0 or even -1,
                >>I think the problem with mod_php configuration on cli with php
                >>everything works fine ...
                >I didn't say use try and catch.  Please try what I wrote.
                >
                >PHP base code doesn't generally throw exceptions.  But it does provide
                >error information if you have it configured to do so.
                >
                In php.ini;
                >
                display_error=o n
                error_reporting =E_ALL & ~E_NOTICE
                >
                That still isn't what I asked you to put in your php.ini file!
                >
                Do you always have this much trouble following a simple request?
                >
                Sorry, I'm not in the habit of wasting my time.  Find someone else to
                help you.
                >
                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstuck...@attgl obal.net
                =============== ===
                >
                .. and also;
                >
                display_error=o n
                error_reporting =E_ALL
                >
                prints nothing..  what a strange mod_php malfunction..
                Oh! what a shame!
                Directory permissions, which is the database located, must allow to
                write!...
                chmod 777 todir has been removed all problems;)

                Comment

                • Jerry Stuckle

                  #9
                  Re: Can not insert data into SQLite3 database

                  Betikci Boris wrote:
                  On Sep 1, 12:08 pm, Betikci Boris <pard...@gmail. comwrote:
                  >On Aug 31, 5:04 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                  >>
                  >>
                  >>
                  >>Betikci Boris wrote:
                  >>>On Aug 31, 4:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                  >>>>Betikci Boris wrote:
                  >>>>>On Aug 30, 4:38 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                  >>>>>>Betikci Boris wrote:
                  >>>>>>>Can not insert data intoSQLite3data base through browser however i
                  >>>>>>>can easily insert data into my db from konsole, in both attmpts i used
                  >>>>>>>php 5.2.6 on 2.6.25.* linux kernel
                  >>>>>>>i think there is a problem with my php setup but i could not find
                  >>>>>>>it...
                  >>>>>>>here is the code;
                  >>>>>>>----------------------------------------------------------------------------------------
                  >>>>>>>$db = new PDO("sqlite:bar .db");
                  >>>>>>>$sql = "select * from user";
                  >>>>>>>$query = "insert into user values(null,'fo o','bar')";
                  >>>>>>>$db->query($query );
                  >>>>>>>print_r( $db->query($query)) ;
                  >>>>>>>print_r( $db->query($sql)) ;
                  >>>>>>> foreach ($db->query($sql) as $row)
                  >>>>>>> print $row['id'] . " " . $row['text'] . " " . $row['text2'] .
                  >>>>>>>"<br>" ;
                  >>>>>>>unset($d b);
                  >>>>>>>------------------------------------------------------------------------------------------
                  >>>>>>>first print_r() function prints nothing, actually "select" works,
                  >>>>>>>"inser t" wouldn't....
                  >>>>>>>What's the problem?
                  >>>>>>Enable all errors and display them - in your php.ini file, ensure you have:
                  >>>>>>display_e rror=on
                  >>>>>>error_rep orting=E_ALL
                  >>>>>i've tried with try catch but that's the point there is nothing to
                  >>>>>report.. According to this function =print_r($db->query($query)) ;
                  >>>>>query returns 0 or even -1,
                  >>>>>I think the problem with mod_php configuration on cli with php
                  >>>>>everythi ng works fine ...
                  >>>>I didn't say use try and catch. Please try what I wrote.
                  >>>>PHP base code doesn't generally throw exceptions. But it does provide
                  >>>>error information if you have it configured to do so.
                  >>>In php.ini;
                  >>>display_erro r=on
                  >>>error_report ing=E_ALL & ~E_NOTICE
                  >>That still isn't what I asked you to put in your php.ini file!
                  >>Do you always have this much trouble following a simple request?
                  >>Sorry, I'm not in the habit of wasting my time. Find someone else to
                  >>help you.
                  >>--
                  >>============= =====
                  >>Remove the "x" from my email address
                  >>Jerry Stuckle
                  >>JDS Computer Training Corp.
                  >>jstuck...@att global.net
                  >>============= =====
                  >.. and also;
                  >>
                  >display_error= on
                  >error_reportin g=E_ALL
                  >>
                  >prints nothing.. what a strange mod_php malfunction..
                  >
                  Oh! what a shame!
                  Directory permissions, which is the database located, must allow to
                  write!...
                  chmod 777 todir has been removed all problems;)
                  >
                  Which, would have been indicated by an E_NOTICE message if you would
                  have followed my initial instructions. You probably changed the wrong
                  php.ini file.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  Working...