Milti has asked for the wisdom of the Perl Monks concerning the following question:
I am using Mysql 8.4 and am trying to use a form to provide info to a Perl cgi to insert data into a Mysql database table. Previous I used Mysql 5.7 and was successful with these statements:
Everything worked! Now it doesn't work. I have gotten an error message noting syntax error near my $sth=$dbh->prepare and another one indicating the use of place holders has been deprecated and cannot be used. I'm at a lost for ideas. Can anyone provide the currently acceptable way to use Perl statements to insert the data into the table? I would truly appreciate any help offered.use DBI; print "Content-type: text/html\n\n"; use POSIX qw(strftime); $shortdate = strftime "%B %d, %Y", localtime; $Posted=$shortdate; $JobID=param('JobID'); $EmployerID=param('EmployerID'); $EmployerName=param('EmployerName'); $Title=param('Title'); $City=param('City'); $StateProvince=param('StateProvince'); $Description=param('Description'); $Function=param('Function'); $Sector=param('Sector'); $Country=param('Country'); my $dbh = DBI->connect('dbi:mysql:jobs_db','poster','posterpasswd'); my $sth =$dbh->prepare("INSERT INTO jobs (JobID,EmployerID,EmployerNam +e,Title,City,StateProvince,Description,Function,Sector,Country,Posted +) Values(?,?,?,?,?,?,?,?,?,?,?)"); $sth ->execute($JobID,$EmployerID,$EmployerName,$Title,$City,$StatePro +vince,$Description,$Function,$Sector,$Country,$Posted);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl and Mysql Queries
by talexb (Chancellor) on Jun 10, 2024 at 18:37 UTC | |
by Milti (Beadle) on Jun 10, 2024 at 19:35 UTC | |
by Danny (Chaplain) on Jun 10, 2024 at 19:43 UTC | |
by etj (Priest) on Jun 11, 2024 at 08:41 UTC | |
by mldvx4 (Friar) on Jun 11, 2024 at 09:59 UTC | |
by talexb (Chancellor) on Jun 11, 2024 at 01:56 UTC | |
by Milti (Beadle) on Jun 11, 2024 at 12:27 UTC | |
by hippo (Archbishop) on Jun 11, 2024 at 12:47 UTC | |
| |
by talexb (Chancellor) on Jun 11, 2024 at 13:14 UTC | |
| |
by soonix (Chancellor) on Jun 11, 2024 at 12:52 UTC | |
by Danny (Chaplain) on Jun 11, 2024 at 14:21 UTC | |
by GrandFather (Saint) on Jun 10, 2024 at 22:08 UTC | |
Re: Perl and Mysql Queries
by Corion (Patriarch) on Jun 10, 2024 at 17:18 UTC | |
by Danny (Chaplain) on Jun 10, 2024 at 18:04 UTC | |
Re: Perl and Mysql Queries
by Milti (Beadle) on Jun 12, 2024 at 14:36 UTC | |
by The_Dj (Scribe) on Jun 13, 2024 at 01:35 UTC | |
by Bod (Parson) on Jun 14, 2024 at 23:09 UTC | |
by hippo (Archbishop) on Jun 15, 2024 at 08:43 UTC | |
by Danny (Chaplain) on Jun 12, 2024 at 15:21 UTC |