Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Fetching values in Perl

From: Baron Schwartz <baron(at)xaprb.com>
Date: Fri Sep 28 2007 - 09:20:53 EDT


Hi,

padmaja wrote:
> Hi all,
> I have written a query like this.
> ----------------------------------------------------------
>
> $dbh= DBI->connect("dbi:mysql:dbname=$database;host=$hostname", "$username",
> "$password");
>
> $statement = "SELECT patient_intime from $table_name where
> patient_intime=$ARGV[0])";
>
>
> ----------------------------------------------------------
> I want all the "patient_intime" values to be retreived, where there are
> other columns(fields) also.

Try this:

SELECT * FROM $table_name ....

SELECT * is not a good idea to just blindly write, though. In general it's a much better idea to explicitly name the columns you know you need   (it's more efficient, you don't get any nasty surprises when someone adds another column to the table, you will get an explicit error when someone drops a column your application actually needs...)

Baron

-- 
MySQL Perl Mailing List
For list archives: 
http://lists.mysql.com/perl
To unsubscribe:    
http://lists.mysql.com/perl?unsub=lists@pantek.com
Received on Fri Sep 28 09:28:11 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 10:15:36 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library