I have a database with a TEXT field, which could have just one paragraph, or as many as 50 paragraphs. More likely it will have more than 10. I also have another database table with a number of sponsors that could be 0-10. No more than 10 ever.
I need to find a way to have it where the text that is displayed will automatically insert one sponsor for every equal number of paragraphs.
Such as this. Say there are 3 sponsors and 10 paragraphs, I would like it to print 3 paragraphs, then insert a table with the first sponsor, then print another 3 paragraphs, then insert another table with the second sponsor, then print another 3 paragraphs, then the final sponsor table, and then the last paragraph.
It really does not have to be in between the paragraphs, I guess it could be between words, but how can I just find equal places to put the sponsors in the text?
Would it work to count the "length" of the text, then divide that by the number of sponsors, then find the next "space" after the first number?(Such as this:
The text field has a length of 3000 characters, and there are 3 sponsors, then there would be 1 sponsor after every 1000 characters.)
How would I find the next space between words, AFTER 1000 characters(in the above example)?
Or do you know of a better way to do this?
I would appreciate any tips on a way to do this.
Thank you!
Richard
Edited by BazB - fixed .sig div tags.