mscdelete
戻る
#!C:/perl/bin/perl
######################################
# mscdelete.pl
######################################
use strict;
use DBI;
use CGI qw/:standard/;
use HTML::Template;
my ( %t, @rec, @loop, $n );
$t{q} = new CGI;
$t{enq1_id} = $t{q}->param("enq1_id");
$t{id1} = $t{q}->param("id1");
$t{item} = $t{q}->param("item");
$t{template} = HTML::Template->new(filename => 'mscdelete.htm');
$t{dsn} = "DBI:mysql:host=localhost;database=cookbook";
$t{dbh} = DBI->connect($t{dsn}, "cbuser", "cbpass") or die "Cannot connect to server\n";
$t{dbh}->do("SET NAMES utf8");
if(!$t{dbh}){
print "SQL read ERROR!\n";
exit;
}
$t{name1id} = $t{dbh}->selectrow_array("select $t{item} from enq1 where id = $t{enq1_id}");
@{ $t{name1id_list} } = split(/==/,$t{name1id});
@{ $t{name1ids} } = ();
for $n ( 0 .. $#{ $t{name1id_list} } ) {
next if ( $t{name1id_list}[$n] == $t{id1} );
push(@{ $t{name1ids} },$t{name1id_list}[$n]);
}
$t{name1id_new} = join('==',@{ $t{name1ids} });
$t{sql} = 'UPDATE enq1 set ' . $t{item} . ' = "';
$t{sql} .= $t{name1id_new} . '" where id = ';
$t{sql} .= $t{enq1_id};
$t{DO} = $t{dbh}->do($t{sql});
$t{dbh}->disconnect;
$t{template}->param(enq1_id => $t{enq1_id});
$t{template}->param(DO => $t{DO});
$t{template}->param(sql => $t{name1id_new});
# send the obligatory Content-Type and print the template output
print $t{template}->output;
1;
-------------------------------------------------------------------------------
mscdelete
mscdelete
http://localhost/scripts/mscenq1_p.pl
ENQ_ID==>
DO==>
sql==>
戻る
延津县|
乌兰县|
黑水县|
锡林郭勒盟|
丰都县|
临城县|
上林县|
阿巴嘎旗|
安阳市|
宜兰市|
舟曲县|
濮阳市|
六盘水市|
沁阳市|
大方县|
涞源县|
安阳县|
炎陵县|
和静县|
苏尼特左旗|
银川市|
临汾市|
芜湖县|
收藏|
即墨市|
海南省|
伊宁市|
通榆县|
孟津县|
麻城市|
潼南县|
黑水县|
绥宁县|
奉新县|
临武县|
莆田市|
建瓯市|
饶河县|
齐齐哈尔市|
措美县|
新丰县|