I am currently writing an internal email script into DBManSQL V1 and have run into a problem. I haven't gotten to the point of figuring out loops and how to set them up to work with queries.
Here is what I have so far:
print qq| <b><input type="checkbox" name="ID" value="$row->{ID}"> <font color="black"><$sizefont>$row->{date}</font><$sizefont><font color="black"> - <a href="$db_script_link_url&ID=$row->{ID}&show_message=1&ww=on">$row->{received}</a></font><$sizefont><font color="black"> - $row->{subject}</font></b><hr> |;
That is a message link with checkbox. The checkbox is for selecting single or multiple (if I can get it working) messages for marking unread, deleting etc. Here is the sub for marking messages unread:
sub mark_unread {
# --------------------------------------------------------
my $ID_q = $DBH->quote($in{'ID'});
$query = qq!
UPDATE $db_comments SET messageread = '0'
WHERE ID = $ID_q
!;
$rc = $DBH->do($query);
$rc ?
($message_q = "User: $in{'username'} updated.") :
($message_q = "Error updating user: $in{'username'}. Reason: $DBI::errstr");
if ($rc) {
&html_view_messages($message);
}
else {
&html_view_messages($message);
}
}
So far, that will work if I check 1 message and click the submit button. But I need this to be able to work if more than 1 message is checked. How can I get this to work with more than 1 message being checked?
Thanks for any help!
Shannon
Here is what I have so far:
print qq| <b><input type="checkbox" name="ID" value="$row->{ID}"> <font color="black"><$sizefont>$row->{date}</font><$sizefont><font color="black"> - <a href="$db_script_link_url&ID=$row->{ID}&show_message=1&ww=on">$row->{received}</a></font><$sizefont><font color="black"> - $row->{subject}</font></b><hr> |;
That is a message link with checkbox. The checkbox is for selecting single or multiple (if I can get it working) messages for marking unread, deleting etc. Here is the sub for marking messages unread:
sub mark_unread {
# --------------------------------------------------------
my $ID_q = $DBH->quote($in{'ID'});
$query = qq!
UPDATE $db_comments SET messageread = '0'
WHERE ID = $ID_q
!;
$rc = $DBH->do($query);
$rc ?
($message_q = "User: $in{'username'} updated.") :
($message_q = "Error updating user: $in{'username'}. Reason: $DBI::errstr");
if ($rc) {
&html_view_messages($message);
}
else {
&html_view_messages($message);
}
}
So far, that will work if I check 1 message and click the submit button. But I need this to be able to work if more than 1 message is checked. How can I get this to work with more than 1 message being checked?
Thanks for any help!
Shannon