By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.


P: 22
Hello All,

Thanks for any help you can give in advance. This is what I'm trying to do...I have entries going into a database. The entries can be UP to 1500 words. I want the query results from the database to be formatted for publishing in a book. For instance, every 5-8 sentences is a paragraph, at every new paragraph you indent, if one entry is less than a paragraph (i.e. 10 words) continue the next entry where the last entry left off until 5-8 sentences is reached.

Currently I have it coded whereby every entry is indented but that is all. This is the code I have:

Expand|Select|Wrap|Line Numbers
  1. <style>
  3. {
  4.    text-indent:1em;
  5.    margin-top: 0;
  6.    margin-bottom: 0;
  7.    margin-left: 0;
  8.    margin-right: 0;
  9.    font-size: 18px;
  11.   }
  12. </style>
[PHP]$db=mysql_connect ($sql_host, $sql_user, $sql_password) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($sql_db);
$query="SELECT ENTRY FROM entries WHERE TOPIC='$topic'";
$query="SELECT ENTRY FROM entries";

$result = mysql_query($query) or die (mysql_error());



$myentry=mysql_result($result, $i, "ENTRY");
echo '<p class="new">' .$myentry.'</p>';

echo "There are no entries in the database";

Can someone help me accomplish what I'm trying to do.
Dec 28 '07 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 5,821
Heya, Lilbit.

How would your app be able to determine when a new paragraph occurs?
Dec 31 '07 #2

P: 22
Now that's a good question. Don't know. What do you suggest I do?
Jan 3 '08 #3

Expert 5K+
P: 5,821
Heya, Lilbit.

You'd need some kind of hinting, such as a line break or extra punctuation. You could assume that a new paragraph occurs every x sentences, but this is probably not optimal.
Jan 3 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.