rich731 has asked for the wisdom of the Perl Monks concerning the following question:
#get data from DB my $sth = $dbh->prepare("SELECT * FROM publications") or error($cgi, " +Error #1"); $sth->execute( ) or error($cgi, "Error #2: ". $dbh->errstr( )); #loop through data while (my $data = $sth->fetchrow_hashref) { #pull out only the first 15 words from the pubText field #this is where I need suggestions, the code below does not work while ($count < 15){ @copy = split " ", $data->{pubText}; $count ++ } #print resulting data print qq{ <td width="195" align="left" valign="top"><div class +="newsBox"><span class="newsTitle">$data->{pubTitle}</span><br /> @copy <a href="http://linkToFullArticle.html">More...< +/a> </div></td> }; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Truncate Data from MySQL
by jwkrahn (Abbot) on Jul 07, 2009 at 11:28 UTC | |
|
Re: Truncate Data from MySQL
by ww (Archbishop) on Jul 07, 2009 at 12:31 UTC | |
by mzedeler (Pilgrim) on Jul 07, 2009 at 18:51 UTC | |
by ww (Archbishop) on Jul 07, 2009 at 22:19 UTC | |
by mzedeler (Pilgrim) on Jul 09, 2009 at 19:59 UTC | |
|
Re: Truncate Data from MySQL
by CountZero (Bishop) on Jul 07, 2009 at 19:35 UTC | |
by wol (Hermit) on Jul 07, 2009 at 22:27 UTC | |
by spazm (Monk) on Jul 08, 2009 at 20:01 UTC | |
|
Re: Truncate Data from MySQL
by poolpi (Hermit) on Jul 07, 2009 at 12:58 UTC | |
by kulls (Hermit) on Jul 07, 2009 at 14:16 UTC | |
by wol (Hermit) on Jul 07, 2009 at 22:18 UTC | |
by stevemayes (Scribe) on Jul 08, 2009 at 05:46 UTC | |
by zebedee (Pilgrim) on Jul 08, 2009 at 07:53 UTC |