Prev: FAQ 4.34 How do I extract selected columns from a string?
Next: Work at Home- Earn $4,000 Weekly With Email Reading Jobs
From: Henry Law on 14 Feb 2010 11:39 I'm trying to do something very simple: query an existing MYSQL table for a single row or set of similar rows. Code fragment below. I'm getting "Illegal parameter number" but my code looks perfectly correct. I've looked at the module source and the appropriate section is if (param_num <= 0 || param_num > DBIc_NUM_PARAMS(imp_sth)) { do_error(sth ... etc This suggests that the only test is on the size of the parameter number. Of course I've Googled, both web and groups; numerous hits but all much more complicated than my example, and the fixes don't help. Can someone suggest where to look next, please? ------------ code fragment (not executable as it is ) ------------ > my $qry_sth = $dbh->prepare("SELECT * FROM master WHERE name='?' ORDER BY mod_date DESC") > or die "Failed to prepare SELECT statement\n"; > # Query the DB and check the file(s) returned > $qry_sth->bind_param( 1, "$_" ); > $qry_sth->execute() or die "Execute of query statement failed\n"; ------------------------------------------------------------------ Error is "DBD::mysql::st bind_param failed: Illegal parameter number at bin/chkmaster.pl line 106.", which is the execute statement. I checked with different file names, in case there was something in the name itself that was causing the error, but it happens with all file names as far as I can see. OS is Ubuntu Linux, SQL version is 5.0.67 -- Henry Law Manchester, England |