Hi,
Can anyone see any reason why this would give me a "MySQL server has gone away" error?
# first, we need to enter our values into lsql_Links
my $article = $DB->table('Articles')->select( ['Content'], { LinkID => $link_id } )->fetchrow;
my $sql = qq{ INSERT INTO lsql_Links (ID, Title, LinkOwner, Add_Date, Mod_Date, Description, upload_id, isPremium,PremiumDescription) VALUES ('', ?, 'new_admin', CURDATE(), CURDATE(), ? , ?, ?, ?) };
my $sth = $dbh->prepare( $sql );
$sth->execute($hit->{Title},$article,$hit->{ID},$hit->{isPremium},$hit->{PremiumDescription}) || die "Database connection not made: $DBI::errstr";
$sth->finish();
$dbh->disconnect();
Its driving me mad. All the other scripts work with almost exactly the same format... so I can't see why its giving me this error :/
The error line refers to the $sth->execute part.
TIA
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Can anyone see any reason why this would give me a "MySQL server has gone away" error?
Code:
my $dbh = DBI->connect( "dbi:mysql:$dbnames->{$site_to_go_on};host=$dbhosts->{$site_to_go_on}",$dbuser->{$site_to_go_on},$dbpass->{$site_to_go_on}, { RaiseError => 1, AutoCommit => 0 }) || die "Database connection not made: $DBI::errstr"; # first, we need to enter our values into lsql_Links
my $article = $DB->table('Articles')->select( ['Content'], { LinkID => $link_id } )->fetchrow;
my $sql = qq{ INSERT INTO lsql_Links (ID, Title, LinkOwner, Add_Date, Mod_Date, Description, upload_id, isPremium,PremiumDescription) VALUES ('', ?, 'new_admin', CURDATE(), CURDATE(), ? , ?, ?, ?) };
my $sth = $dbh->prepare( $sql );
$sth->execute($hit->{Title},$article,$hit->{ID},$hit->{isPremium},$hit->{PremiumDescription}) || die "Database connection not made: $DBI::errstr";
$sth->finish();
$dbh->disconnect();
Its driving me mad. All the other scripts work with almost exactly the same format... so I can't see why its giving me this error :/
The error line refers to the $sth->execute part.
TIA
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!