View Full Version : Perl-DBI and Mysql related (Error : fetchrow_array() )

07-25-2006, 07:46 AM
I'm doing a home project on perl-dBI and MySQL. on WINDOWS. I created HTML forms , and doing Database interface.
There is no problem with connecting to database, also i`m able to write data to database without any problem, i.e inserting data to database is working well. and DELETE function is also working properly.
Only problem is selecting the data from the database table, and printing the data on the HTML page.

Im getting following errors,

It is showing "0 Rows", when i used the below function to check whether the SELECT statement is working or not.
my $rows = $sth->dump_results("20");
my select function is:
my $sth = $dbh->prepare(q{SELECT CID,Name,TeleNum,Location FROM TeleDir WHERE CID < 2} ) || die "Couldn't prepare statement: " . $dbh->errstr;

also, im getting fetch error as below,

DBD::mysql::st fetchrow_array failed: Error while describe result set. at C:/www/cgi-bin/teleref.pl line 50., referer: http://localhost/

I tried all the functions of fetch, i.e $sth->fetchrow_array(), $sth->fetchall_arrayref();
Please help me, to rectify the issue..