opigrsajklhbfdsvopa
Technical User
Need expert help! I have a number of scripts written in perl for a flatfile database. I already know how to access the MySQL database through DBI. At least I got that far.
Example of a sub is below. User.pl is a private file created for each member. Members also have a public file for their posts.
What should perl syntax below look like for MySQL? Any help is appreciated.
sub admin_delete {
$user_file = "$as{'user_id'}.pl";
$match = 0;
open(USER_FILE, "$cgi_path/users/$user_file");
flock(USER_FILE,2) if ($flock == 1);
while (<USER_FILE>)
{
$user_posts = $_;
chop $user_posts;
@user_post_fields = split(/\|/,$user_posts);
if ($user_post_fields[0] == $as{'post_id'} && ($user_post_fields[1] == 2)) {
$match = 1;
last;
}
} # end of while
close(USER_FILE);
&error_admin_post_not_found if ($match == 0);
exit;
} # end of sub admin_delete
Example of a sub is below. User.pl is a private file created for each member. Members also have a public file for their posts.
What should perl syntax below look like for MySQL? Any help is appreciated.
sub admin_delete {
$user_file = "$as{'user_id'}.pl";
$match = 0;
open(USER_FILE, "$cgi_path/users/$user_file");
flock(USER_FILE,2) if ($flock == 1);
while (<USER_FILE>)
{
$user_posts = $_;
chop $user_posts;
@user_post_fields = split(/\|/,$user_posts);
if ($user_post_fields[0] == $as{'post_id'} && ($user_post_fields[1] == 2)) {
$match = 1;
last;
}
} # end of while
close(USER_FILE);
&error_admin_post_not_found if ($match == 0);
exit;
} # end of sub admin_delete