Select statement

Select statement

am 21.10.2003 12:59:44 von mark.r.o"sullivan

Hi,
Anyone know the correct syntax for using a select/comparison statement in
the current version of mysql?
I'm having extreme difficulty doing the following. Comparing a value in a
table to a variable passed in.

my $sth = $dbh->prepare("SELECT candidate,task, estimatedSize, approved,
completionDate, successMeasuredBy FROM waitingroom WHERE '$user =
candidate'");

Thanks in advance,
Mark.


************************************************************ **********
This document is strictly confidential and is intended for use by
the addressee unless otherwise indicated.
Allied Irish Banks
************************************************************ **********


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Select statement

am 21.10.2003 13:48:48 von Jochen Wiedmann

mark o' sullivan wrote:

> completionDate, successMeasuredBy FROM waitingroom WHERE '$user =
> candidate'");

How about

$user='candidate'

And, besides, read the secion on placeholders in the DBI manual. Note,
that your own name contains a single quote and will most likely break
the syntax when inserted into the database using that name. In other
words, better use

$sth = $dbh->prepare("SELECT candidate,task, estimatedSize, approved,
completionDate, successMeasuredBy FROM waitingroom
WHERE ?='candidate'");
$sth->execute($user);


Jochen



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Select statement

am 21.10.2003 13:48:48 von Jochen Wiedmann

mark o' sullivan wrote:

> completionDate, successMeasuredBy FROM waitingroom WHERE '$user =
> candidate'");

How about

$user='candidate'

And, besides, read the secion on placeholders in the DBI manual. Note,
that your own name contains a single quote and will most likely break
the syntax when inserted into the database using that name. In other
words, better use

$sth = $dbh->prepare("SELECT candidate,task, estimatedSize, approved,
completionDate, successMeasuredBy FROM waitingroom
WHERE ?='candidate'");
$sth->execute($user);


Jochen



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org