On Wed, 29 May 2002, Greg D. wrote:
> Hello,
>
> I am having trouble collecting the information from a text file that is
> parsed and then delete the information from the current table and import
> the updated information in the table. The delete statement works but
> when i go to import into the table i get this error: DBD::mysql::st
> execute failed: Query was empty at ./cimugd.cgi line 27, <GD> line 1.
> Error2 executing bind Query was empty at ./cimugd.cgi line 27, <GD> line
> 1.
When you put ? in your inserts, you have to pass one parameter to
->execute for each ?. For instance,
$sth->execute($id, $number2, $number3 ....);
and so on.
>
>
> any help will be greatly appreciated thanks..
>
> heres the actual script:
>
> $dbh = DBI->connect($database, $username, $passwd) || die "Error connecting"
> .. $dbh->errstr;
>
> &delete_db;
>
> open(GD, "$ktjpath/$ktjlist") || &death("Can't open $ktjlist: um121");
> while (<GD>){
> ($id, $number2, $number3, $fname, $email, $cemail, $passwd, $code,
> $stuff, $stuff2) = split /\|/;
> $sql_statment = "INSERT INTO ktj (number2, number3, fname, email,
> cemail, passwd, code, stuff, stuff2) values (?, ?, ?, ?, ?, ?, ?, ?, ?)";
> $sth = $dbh->prepare($sql_statement) || die "Error1 preparing insert
> statement:\n" . $dbh->errstr;
> $sth->execute() || die "Error2 executing bind\n" . $sth->errstr;
> }
> close GD;
>
> close STDERR;
>
> #######subroutines#########
>
> sub delete_db{
>
> $sth = $dbh->prepare("DELETE from ktj") || die "3: " . $dbh->errstr;
> $sth->execute();
>
> }
>
>
>
>
- D
<[EMAIL PROTECTED]>