#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> }; }
In reply to Truncate Data from MySQL by rich731
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |