Perl DBI: Getting POST info into select query

From: Mavis (mavistilden_at_hotmail.com)
Date: 10/03/04

  • Next message: Andres Monroy-Hernandez: "Re: Perl DBI: Getting POST info into select query"
    Date: Sun, 3 Oct 2004 13:50:43 -0400
    
    

    Hi,

    I'm trying to use a simple form to select by which column I will display
    output from a MySQL database.

    I'd like to display based on ORDER BY and select Written, Average, etc.

    I know the data is getting to the script from the post, I just can't get it
    to the select statement.

    Here is the code:

    #!/usr/bin/perl

    use DBI;

    $sizeOfFormInformation = $ENV{'CONTENT_LENGTH'};
    read (STDIN, $form_info, $sizeOfFormInformation);

    ($field_name, $command) = split (/=/, $form_info);

    my $dbh = DBI->connect ('DBI:mysql:eln8220s02', root) or die "Couldn't
    connect to database: " . DBI->errstr;

    my $sth = $dbh->prepare('

    select marks.Last_Name, min(marks.Score) as Minimum, max(marks.Score) as
    Maximum, avg(marks.Score) as Average, count(marks.Score) as Count from marks
    where marks.Type = "quiz" and marks.Score > 0 group by Last_Name order by
    [THIS IS WHERE I WANT TO INSERT THE POST DATA] desc

    ') or die "Couldn't prepare statement: " . $dbh->errstr;

    $sth->execute;

    Any help would be appreciated.

    Thanks.


  • Next message: Andres Monroy-Hernandez: "Re: Perl DBI: Getting POST info into select query"

    Relevant Pages

    • Re: large queries
      ... will make SQL queries on a mySQL database that results in very large ... There's a many:many relationship between correspondents and ... populate a JFrame and display it. ... I'm not claimimg this idea (store a minimal list and allow selecting from ...
      (comp.lang.java.databases)
    • Re: Why is this script so slow?
      ... | mysql database that has about 250 records in it. ... | When I use another script to extract the same data and display the ... | I can only conclude it is the script. ...
      (alt.php)
    • Re: Difference between storing files on folder and in mysql db
      ... a separate instance of an image display script (and a separate ... connection to the DB server) to display each image. ... connection if images were stored in the file system. ... mySQL database or if I should just store the files in a dedicated ...
      (comp.lang.php)
    • Re: Help in making links from mysql!
      ... > I have a mysql database with in the database i have ... > How can i display a link with only the title of the document stored?(easy ... You get the five last entries as you have done, ... You query first only the title and the id of the five last entries and ...
      (alt.php)
    • Simple From Generator accessing MySql
      ... I want a simple form generator in PHP that accesses a Mysql database. ... Options for display only, insert new record, and edit. ... I started writing my own, but I am out of time! ...
      (comp.lang.php)