no i want to ask what if someone enters a firstname and last name which doesnot exist in the database...in that case how i can verify and print an error msg that the data doesnot exist for this first name and last name.
Greenhalgh David <[EMAIL PROTECTED]> wrote:Am I understanding you correctly? Your form only has two fields, lastname and firstname? In that case SELECT * FROM table_name WHERE lastname = '$a2' AND firstname = '$a1' works on the command line. (Wasn't sure if you could use the AND like that, but it seems you can) so all you need to do is perlify it with something like use strict; use DBI; . . . my $dbhandle=DBI->connect("DBI:mysql:data_base_name", "username", "password"); my $query = "SELECT * FROM table_name WHERE lastname = '$a2' AND firstname = '$a1'"; my $statementhandle = $dbhandle->prepare($query); $statementhandle->execute; while (($lastname, $firstname, $age, $address) = $statmenthandle->fetchrow()){ print ; } Without forgetting all the die statements! HTH Dave On Tuesday, June 10, 2003, at 07:40 am, Annie wrote: > i have a perl file which is receiving the data from a form...and i > want to verify the two fields $a2 and $a1 i m receiving from form to > be checked in a table in database( using mysql)...and then if the data > is verified in any of the row of the table....the corresponding whole > row data should be fetched. > like if the table has columns > lastname firstname age address > person1 name1 23 add1 > person2 name2 34 add2 > person3.....and so on... > and if $a2='person1' and $a1='name1' then i want to fetch 23 and add1. > > > > --------------------------------- > Do you Yahoo!? > Free online calendar with sync to Outlook(TM). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------- Do you Yahoo!? Free online calendar with sync to Outlook(TM).