At 12:42 AM -0400 6/25/99, Reuben Yau wrote:
>I have a table with a varchar(40) field (among others) which contains
>multiple words, (such as a book title) but when I use perl's DBI to connect
>and run the following:
>
>
>$dsn = "DBI:mysql:database=database;host=sqlhost";
>$dbh=DBI->connect($dsn, "login", "passwd");
>$sth = $dbh->prepare("SELECT * from table);
>$sth->execute;
>while( (@results = $sth->fetchrow) != NULL) {
> print "ID: $results[0]\n";
> print "Title: $results[1]\n";
> print "<p>\n";
>}
>
>
>The $results[1] variable only contains the first word from the mysql field.
>How can I push the whole field value into the variable?
Use $sth->fetchrow_array.
--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/