I'm attempting a search for multiple strings using the bind_param option. My 
understanding is the server will flag each string then after each string has been 
selected and exicuted I can then do a fethall_array.  However the the results only 
include the last string searched. any ideas.  an example query woudl be like [qw/%7th% 
%8th%/] only values for %8th% are returned. help

+++++++++++++++++<snippet>+++++++++++++++++++++++

### extract search pattern, and values and seperate into veriables
    my @search_pat = @_;
    my $pat = $search_pat[0];
    shift (@search_pat);
    my $svalue;
    my $dbh = connect_try("rowan","5340brig");
    my $sql = "SELECT str_no_addr, str_name_addr, cit_addr FROM 
s3a_inglewood_project_info WHERE str_name_addr LIKE ?;";
    ## select rows in table based on search strings - only works with or
    my $sth = $dbh->prepare ($sql) or err_trap("failed to prepare statement\n");
    foreach $svalue (@search_pat){

        $sth->bind_param( 1, $svalue);
        $sth->execute or err_trap("failed to execute statement\n");
    }
    my $array_ref = $sth->fetchall_arrayref();

    # place field names on top
    unshift @$array_ref, [ 'id no.', 'street no.', 'street name', 'city' ];
    # place search values in with everything to make sure i'm getting ligit values
    unshift (@$array_ref, @search_pat);

    $dbh->disconnect or err_trap("failed to disconnect at get_date statement\n");
    gen_table ($array_ref);
}


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to