Siegfried Heintze wrote:
The following code works with perl/MySQL. If I comment the second
line, however, it does not work. No error messages and no results.

If I use the MySQL Enterprise console and type in my first SELECT
statement that includes the LIKE clause, it works.

I'm stumped. There must be something strange with that "%", but I
cannot figure it out.
Anyone got any suggestions?

Siegfried

my $sJobTitle = q[SELECT sName FROM keywords ORDER BY sName WHERE
sName LIKE '%'];

That should raise an error. WHERE clause needs to come befor ORDER BY clause.

Unless you have RaiseError turned on, you aren't checking for errors below.

 $sJobTitle = q[SELECT sName FROM keywords ORDER BY sName];

 my $sth = DBH->prepare($sJobTitle);
 $sth->execute();
 my $row;
 while ($row = $sth->fetch){
   push @sResult,"<li>".join( "", @$row)."</li>\n";
 }


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to