or download this
my $chk_arid = "SELECT MAX( arid ) FROM $table where flag = ?";
my ($arid) = sql_query( $chk_arid , 1 );
...
$pub{teaser}, $pub{text}, $pub{links}, $comment, $aid,
$pub{newsid}, $pub{keywords}, $pub{description}, 1 )
or die("Failed to insert new changed sql data :( \n");