how add/update/delete data in MySQL database here?

Discussion in 'Perl Misc' started by PHP2, Feb 21, 2004.

  1. PHP2

    PHP2 Guest

    how add/update/delete data in MySQL database here?



    CREATE TABLE IF NOT EXISTS example
    (
    item VARCHAR(255) NULL,
    category VARCHAR(255) NULL,
    picture LONGBLOB NULL,
    model VARCHAR(255) NULL,
    serial_number VARCHAR(255) NULL,
    information TEXT NULL,
    date_purchased DATE NULL,
    depreciation DOUBLE NULL,
    assigned_display DOUBLE NULL,
    depreciation_life DOUBLE NULL,
    remaining_life DOUBLE NULL,
    cost DOUBLE NULL,
    book_value DOUBLE NULL

    ) TYPE=MyISAM;



    any help?
    PHP2, Feb 21, 2004
    #1
    1. Advertising

  2. PHP2 () wrote:
    : how add/update/delete data in MySQL database here?



    : CREATE TABLE IF NOT EXISTS example
    : (
    : item VARCHAR(255) NULL,
    : category VARCHAR(255) NULL,
    : picture LONGBLOB NULL,
    : model VARCHAR(255) NULL,
    : serial_number VARCHAR(255) NULL,
    : information TEXT NULL,
    : date_purchased DATE NULL,
    : depreciation DOUBLE NULL,
    : assigned_display DOUBLE NULL,
    : depreciation_life DOUBLE NULL,
    : remaining_life DOUBLE NULL,
    : cost DOUBLE NULL,
    : book_value DOUBLE NULL

    : ) TYPE=MyISAM;


    `DBI' - found on CPAN

    You would also need the mysql DBD module

    Once installed, type perldoc DBI for usage instructions.


    --
    Web Work Wanted, Perl Projects Programmed, Database Development Done.

    I'm looking for telecommute projects. (Paying that is, various
    arrangements possible.)
    Malcolm Dew-Jones, Feb 21, 2004
    #2
    1. Advertising

  3. PHP2

    gnari Guest

    "PHP2" <> wrote in message news:c185kj$m85$...
    > how add/update/delete data in MySQL database here?
    >
    >
    >
    > CREATE TABLE IF NOT EXISTS example
    > (
    > item VARCHAR(255) NULL,
    > category VARCHAR(255) NULL,


    [snip more SQL]

    > any help?


    INSERT INTO example ('foo','bar');

    UPDATE example set information='none' WHERE item='foo';

    DELETE FROM example WHERE cost>0;

    gnari

    P.S.: DBI can help
    gnari, Feb 21, 2004
    #3
  4. PHP2

    PHP2 Guest

    I am totaly newbie in Perl.. can you write to me whole script?



    "gnari" <> wrote in message
    news:c18ho3$47d$...
    > "PHP2" <> wrote in message news:c185kj$m85$...
    > > how add/update/delete data in MySQL database here?
    > >
    > >
    > >
    > > CREATE TABLE IF NOT EXISTS example
    > > (
    > > item VARCHAR(255) NULL,
    > > category VARCHAR(255) NULL,

    >
    > [snip more SQL]
    >
    > > any help?

    >
    > INSERT INTO example ('foo','bar');
    >
    > UPDATE example set information='none' WHERE item='foo';
    >
    > DELETE FROM example WHERE cost>0;
    >
    > gnari
    >
    > P.S.: DBI can help
    >
    >
    >
    >
    >
    PHP2, Feb 21, 2004
    #4
  5. PHP2 wrote:

    > how add/update/delete data in MySQL database here?


    As I previously explained, you are a moron.

    GO AWAY.

    gtoomey
    Gregory Toomey, Feb 21, 2004
    #5
  6. PHP2

    gnari Guest

    "PHP2" <> wrote in message news:c18miv$b2f$...
    > I am totaly newbie in Perl.. can you write to me whole script?


    I do not use MySQL, but a script could contain bits like this:

    use DBI;
    my $dbh =
    DBI->connect("dbi:mysql:database=$yourdatabasename",$username,$password);
    $dbh->do("INSERT INTO example VALUES ('foo','bar')");
    $dbh->do("INSERT INTO example VALUES (?,?)",'foo2','bar2');
    $dbh->do("UPDATE example set information='none' WHERE item='foo'");
    $dbh->do("DELETE FROM example WHERE cost>0");

    gnari
    gnari, Feb 21, 2004
    #6
  7. PHP2

    PHP2 Guest

    thanks for your help


    "Gregory Toomey" <> wrote in message
    news:1859826.qnntlf9aQj@GMT-hosting-and-pickle-farming...
    > PHP2 wrote:
    >
    > > how add/update/delete data in MySQL database here?

    >
    > As I previously explained, you are a moron.
    >
    > GO AWAY.
    >
    > gtoomey
    PHP2, Feb 21, 2004
    #7
  8. PHP2

    PHP2 Guest

    thanks

    "gnari" <> wrote in message
    news:c18pnt$59g$...
    > "PHP2" <> wrote in message news:c18miv$b2f$...
    > > I am totaly newbie in Perl.. can you write to me whole script?

    >
    > I do not use MySQL, but a script could contain bits like this:
    >
    > use DBI;
    > my $dbh =
    > DBI->connect("dbi:mysql:database=$yourdatabasename",$username,$password);
    > $dbh->do("INSERT INTO example VALUES ('foo','bar')");
    > $dbh->do("INSERT INTO example VALUES (?,?)",'foo2','bar2');
    > $dbh->do("UPDATE example set information='none' WHERE item='foo'");
    > $dbh->do("DELETE FROM example WHERE cost>0");
    >
    > gnari
    >
    >
    >
    >
    PHP2, Feb 22, 2004
    #8
  9. PHP2 wrote:

    > thanks for your help
    >

    You are asking a question about mysql; this is a Perl newsgroup.

    Try www.dbforums.com or a mysql newgroup if you have mysql questions.

    gtoomey
    Gregory Toomey, Feb 22, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UW5hdnJ5?=

    one page to edit, delete, and add data to a database

    =?Utf-8?B?UW5hdnJ5?=, Nov 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    358
    Tod Birdsall
    Nov 3, 2004
  2. dwok
    Replies:
    2
    Views:
    458
    Lucas Tam
    May 11, 2005
  3. 0to60
    Replies:
    4
    Views:
    304
    Jerry Coffin
    Dec 19, 2003
  4. Alina Ghergu
    Replies:
    3
    Views:
    486
    Alina Ghergu
    Sep 6, 2006
  5. julian
    Replies:
    8
    Views:
    440
    Avatar
    Apr 6, 2006
Loading...

Share This Page