-Scott
#!/usr/bin/perl -w use strict; use DBI; #use autodie; $\="\n"; my $res_tbl="SOMETABLE"; my $loc_tbl="OTHERTABLE"; my $res_select_stmt = "Select * from $res_tbl order by id"; my $loc_select_stmt = "Select location from $loc_tbl where resource_id + = ?"; my $db="SOMEDB"; my $dbun="SOMEUN"; my $dbpw = 'SOMEPW'; my $dbhost="SOMEHOST.hostedresource.com"; my $res_tbl="resource_list"; my $loc_tbl="matrix_locations"; my $drh = DBI->install_driver("mysql") || print "install_driver failed +: $DBI::errstr <br/> +"; my $dsn = "DBI:mysql:database=$db;host=$dbhost"; my $dbh = DBI->connect($dsn,$dbun,$dbpw) || print "DB connect failed: +$DBI::errstr <br/>" my $res_select_stmt = "Select * from $res_tbl order by id"; my $loc_select_stmt = "Select location from $loc_tbl where resource_id + = ?"; my $update_res_stmt = "UPDATE $res_tbl SET name=?, link=?, availabilit +y=? WHERE id=?"; print "Updating $res_tbl item with stuff \n"; my $sth = $dbh->prepare($update_res_stmt) or warn "prepare UPDATE stat +ement failed: $dbh->errstr"; my $rv = $sth->execute("test","link test", "test availability", 7) || +warn "Execute update failed: $dbh->errstr"; $sth->finish; print "$res_tbl updated with return value '$rv'.\n"; my $select_sth = $dbh->prepare($res_select_stmt) || print "prepare sta +tement failed: $DBI::errstr <br/>"; $select_sth->execute() || print "execute statement failed: $DBI::errst +r <br/>"; my $results = $select_sth->fetchall_arrayref(); $select_sth->finish(); foreach my $row (@$results){ print join ',' , @$row; print '\n'; } $dbh->disconnect();
In reply to Re: Mystified by why my UPDATE statement is not reflected in my database display
by 5mi11er
in thread Mystified by why my UPDATE statement is not reflected in my database display
by OfficeLinebacker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |