Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Database (MySQL)

Expand Messages
  • Ingenue
    For a few bucks, you should invest in the O Reilly mSQL and mySQL book. They have plenty of examples for many different languages. It also teaches you SQL
    Message 1 of 1 , May 7 3:05 PM
    • 0 Attachment
      For a few bucks, you should invest in the O'Reilly mSQL and mySQL book.
      They have plenty of examples for many different languages. It also teaches
      you SQL syntax and commands.


      You probably want to use DBI module for Perl.

      use DBI;

      my $sql = DBI->connect('DBI:mysql:DATABASE:localhost', "user", 'password');

      unless($sql){
      print "Cannot connect to SQL database";
      exit;
      }

      my $submit = "SELECT * FROM table_name";
      my $table = $sql->prepare($submit);
      $table->execute;

      my $rows = $table->rows;

      while (my($_foo, $_bar, $_count)=$table->fetchrow_array)
      {
      do stuff
      }

      $sql->disconnect;


      ----- Original Message -----
      From: "Desmond Ng" <desmond_nwh@...>
      To: <perl-beginner@egroups.com>
      Sent: Sunday, May 07, 2000 7:09 AM
      Subject: [PBML] Database (MySQL)


      > Can anyone give me the source code to link perl to mySQL database and
      > how do i find something using the select command from one of the
      > table.
      > Just a few example will do.
      > Just label the database name as database, table as table.
      >
      > Thank & Regards,
      > Desmond
      >
      >
      >
      > ------------------------------------------------------------------------
      > Porsche Boxter. You and a friend. Nine dream days from
      > Napa Valley to Beverly Hills. Provided by CarsDirect.com.
      > Click to enter.
      > http://click.egroups.com/1/3993/2/_/12898/_/957708557/
      > ------------------------------------------------------------------------
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.