Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Traverse And Insert Page Breaks?


My website is going to host various and future pieces of my writing. Some of the pieces are going to be very long, so I need to split them up over multiple pages. I have an input form through which I can type or paste a piece of writing and have it inserted into MySQL. What I need now is to have PHP automatically insert page breaks before the piece is inserted.

I was told I could use regular expressions, or I could use PHP to traverse the string and insert a page break, say, after 1400 characters so long as it ends on a period.

I know of str_replace, but how do I set it go a certain amount of characters? This whole pagination thing has me completely stumped. I'm not looking to paginate display results. I'm displaying one result split up in pages.




View Complete Forum Thread with Replies

Related Forum Messages:
Traverse Directories
My problem is that I can't find a way of referencing files and
includes statically. I have to change each page reference so that when
it is referenced it references the correct document. As I want a
central location to keep all my most used 'includes'.

So if I change a scripts location I also have to change the script
it's self to point to the correct documents. This is a problem when
the directory structures hierarchy keeps changing.

Also HTTP referencing is out as the scripts will not all be run on the
same servers.

View Replies !
Page Breaks In Text Reports
How can I make page breaks in .txt reports? Is this even possible with php?

View Replies !
Reports With Page Breaks For Printing
Is there a simple solution for generating mysql db reports with php?  I can make tables but I'd like to make something that partitions the pages properly for printing.  I've looked at some of the sw packages on the web and they either look too complicated or too simple (it's not just a table dump - there is some processing involved).

I guess I'm looking for a tutorial to do it myself.  I just don't know how to format teh output for printing.  I could wing it by trial and error but if I'm going by number of rows or somethign to cutoff the page a single line wrap in a row would throw it all off.

So far my db is just php/mysql with standard html (tables and stuff).  I haven't gotten into css yet but I'm guessing I could need it to make this work.  Any help is greatly appreciated !!

Oh if it wasn't clear I'm talkign about reports users can generate through the website.  They don't have to design the report, just view a report with the current db data. I'll design the report formats.

View Replies !
Creating Text File With Page Breaks
If is a newline and is a carraige return, what special character is used for a page break?

View Replies !
Creating .xls And .doc Files With Page Breaks Using PHP / MySQL
Our company currently processes a few hundred form submissions through
our site. Up till now, the contents of the form has been sent to our
customer support staff in real-time. Each submission goes to a general
e-mail box where it's printed through our mail client. A copy of the
form is also stored in a MySQL db, although it's not used that often.

I have been asked to figure out a way to stop delivering the form
submissions in real-time and migrate to the following:

Each morning, provide an Excel spreadsheet and word document (or PDF)
with a certain number of form submissions to each customer support
rep. For example, say 200 form submissions were processed the day
before. This morning, I should split those 200 among the 5 support
reps and provide each of them a certain amount (which can change
daily). Assuming each person gets 40 form submissions, each person
would need to be given an excel file and .doc document that contains
their 40 form submissions.

One of the most important things is that the .doc file needs to have
each form submission separated by a page break, so that when they
print the document each form submission is printed on a separate page.

Finally, not all of the fields from the form submission should be
given to the support rep. Maybe date and time is left off.

View Replies !
Insert A Page Break For Printing Purposes After X Records On Page.
I need to insert a page break for printing purposes after X records on page. I'm querying five diffrent records with 5 different results and displaying them like:

$record1
$record2
$record3 and so on

So I want to get total number of records which is pretty easy I just add all the totals let's call it $subtotal. Then I want a page break after every 20 records of the $subtotal. Is this possible?

View Replies !
Insert Page Into Template
I have a script that uses a template for my site. I am trying to add a page(s) to it and have the pages use the template. The template has an area where I want the contents of my other page to appear. The other parts of the script use this PHP Code:

View Replies !
Insert A Page Break
I have a for statement that looks something like this: PHP Code:

for ($i = 1; $i <= 100; $i++) {
        
        echo '<a href="someurl.php?p=$i">Link</a>&nbsp;|&nbsp;'

}

I'd like to put in a <BR> tag after every multiple of 10. I've tried to use a nested for statement, but I just get errors. I don't think I'm doing it right.

View Replies !
How To Insert Tab In An Html Page???
i am making one appllication inwhich the user enters text in textarea field. i am saving this value in database and when user accesses value from database, i want to display text in a format entered by user.

i.e. if the user has entered some text in 2nd line then it should be displayed on second line and not after the end of first line in continuation. if user has entered tab in some location, the tab will be displayed while viewing data from database.

View Replies !
Insert/select From Same Page
I was wondering (and I suspect I already know the answer) if it's possible to insert data into a mysql table and select that same data from within the same php page.

View Replies !
OOP Page: Where To Put Update, Insert, Delete
I have a page that shows info from MySQL. It is for an online education
site. It uses different classes arranged in a hierarchy. Each lesson is
roughly laid out like this:

Lesson
|-Intro
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Summary

I have all the classes working properly for displaying info from the
database. Now I am building the admin site.

Where should I put the update/insert/delete code? Would those go inside the
classes? Should I use the lesson object when doing the maintenance? Or,
should I just have a separate page that handles the database stuff and only
use the objects to display the data from the database?

View Replies !
INSERT Data On Page Load?
I have an avatar system where certain avatars are locked until the user unlocks them by going to certain pages of the site.

So far ( being the newb I am ) I only know how to INSERT data from a form. Is there a way to do it on page load or similar?

I also need it to first check if the data already exists and if not it inserts the data and then displays a message to the user that they have unlocked the avatar. Code:

View Replies !
Insert To Database On Page Load
I have the code for inserting data to a database form a form (Code below) but I want the data to be entered upon a page loading, how would I do this? Code:

View Replies !
Refeshing Page Duplicate Insert
I am creating a registration script for my site and it is posted to itself. The problem is that when all the information is inserted into the database and i display what you have inserted, like username and email etc.

If i refresh the page then it tries to insert it all again flashing up a dublicate entry message. How can i get around this? I thought of a redirect but would prefere not to.

View Replies !
How To Simply Display On My Page Another Insert From A Different Table.
$judet = $_GET["judet"];

$result = mysql_query ("SELECT oras, id_oras FROM orase WHERE id_oras = '{$judet}' ORDER BY oras");

This is a piece of my code. The variable $judet is working perfect but i have a problem with another variable in the same table with judet witch i can't call.Everything from table orase works i just don't know how to simply display on my page another insert from a different table.

View Replies !
Howto Insert Picture Stored In Directory With Url In Db Onto Web Page?
If I read one tutorial more on how to store a image inside a mysql database I will blow my mind.

I read everywhere on the forums to store the image on the harddrive and use the url in the database and then pull the image out of the directory and onto a web page.

I am new to PHP and mysql but have looked now for two weeks on how to code a page to do this. It really has to be simple, so simple no one has taken the time to write a tutorial on it. There are lots, many, plenty, please no more tutorials on using BLOB to store an image inside a database.

What is the code to pull a image from a dir. using a url in the db and put it on a web page, I have been trying my own ideas and not working....NO I don't want to use BLOB.

darn thing with php, you can't see the code that does the trick...all I can see is the std <img scr="blab,blab,blab">

View Replies !
Stopping Another Data Insert When User Reloads Page
My PHP script inserts data into a mysql table that has been passed into it.

My question is, what is the general method by which to ensure that if a user reloads the screen, the same set of data doesn't get duplicated into the database?

For instance, I am inserting ticket data (its an ecommerce event system) into a mysql and really dont want duplicated entries if the user happens to press reload or back or whatever

Any ideas?

View Replies !
Multi Page Form Question Concerning $id = Mysql Insert Id();
I am creating a multi page form. The code below is what I am using. However, I am having a difficult time having it post to MySQL under "pg2" where it posts to MySQL I have the function $id = mysql_insert_id(); to post the id from "pg1" post to the database. However it only post 0 which I think is due to it being in an array. Code:

View Replies !
Use The Php Include Command In Source Code To Insert External Page
Hello, i am trying to use the php include command in source code to insert external page when a main page loads, but get the following errors.. can you help?

View Replies !
Header Problem - Insert The Info Below And Then Jump Back To A Page.
i want to insert the info below and then jump back to a page. Here is insert and the header statement: PHP Code:

View Replies !
Automatically Open Default Mail Program And Insert The Current Page Of Browser As The Body Of The Message.
On my website I would like the facility to click on an image or text that will automatically open up their default mail program and insert the current page on their browser as the body of the message.

I realise that most browsers will have this facility already but I would like to add my own method. Problem is, I have no idea on how to achieve this. I'm sure it can't be that difficult though. It maybe can be done just using HTML, I don't know.

View Replies !
Insert Values - Table Has Four Columns To Insert Into
I have a bunch of information that I want to insert into a table

insert into TABLE values ('hello','I','am','lost');

pretend that the words that are being inserted are coming from a form for another page. In he case I above I have declared that the table has four columns to insert into. What if I do not know how many columns there are?

View Replies !
Insert Into Table - $query = "INSERT INTO Tbl
I have a small problem which I've been working on for a while. PHP Code:

$query = "INSERT INTO tbl(username,ip,link) VALUES("Brin' . $result['id'] . '","$REMOTE_ADDR","http://www.domain.com/sub/start.php?username=Brin"' . $result['id'] . ' )";
mysql_query($query);

Any ideas?

View Replies !
Add Breaks
I want to amke it so that when I have a return in a textarea, and it sends it to my database it inserts <br /> tags to the places I pressed enter. How would I do it?

View Replies !
Line Breaks In PDF
I am trying to create PDF-s using PDFLIB. This works fine, as long as the printed text does not exceed one line. I cannot create a linebreak, so when I use the code below, the text seems to run of the screen.

View Replies !
Line Breaks
I've got in mysql table a TEXT field where I've got this contents:
"This
is a
text"

Now, I want to put this text into a javascript but than I need it convert it this way : "This
is a
text"

Do you think this is possible?

View Replies !
(H) In Line Breaks
I have a cell phone with full internet access. I have an HTML page
that I wrote specifically for use on my cell phone. It uses PHP's
fopen() to open files on my server and then displays the contents of
the file I opened using a <textarea>. This allows me to update my site
from my cell phone.

It works fine from a browser on my computer, but when I use it to open
a file from my cell phone, all the line breaks are preceded by this
character that looks like a copywrite symbol, but with an (H).
Extended ASCII 233 according to http://www.asciitable.com . I write
the pages in Dreamweaver MX initially, which gives me a few options
about how to write line breaks (either for Linux, Windows, or Mac; CR,
LF, CR LF) but I need my files to work on all three of my operating
systems, since I use a Mac a home, a PC at school, and my server is
Linux.

I'm guessing that my computer is writing CR LF and my cell phone is
interpreting it using a different character set where 233 means this
(H) thing instead of CR. But how can I get rid of these characters?
Possibly, could I use PHP to check the user-agent of the client to find
out whether it's a cell phone, then replace all CRLFs with just LFs?
And would I need to put them back in afterwards? If so, how?

View Replies !
Line Breaks Using PHP
I have a PHP script that I need debugging. Below is part of a script I have going. It bascially outputs what has been entered in the form field. Currently, it outputs a long line with no breaks. How can I add paragraph breaks after 25 words or so?

View Replies !
Text Box Breaks?
i have a simple code that echo's text within a textbox after submit. but it just puts it all together, it dosn't keep the lines! like if the person pressed "Enter" like 4 times it wouldn't matter, it just puts it into 1 jumble. how do i fix that?

<form method="post">
<textarea id="text1" name="text1" rows="10" cols="30"></textarea>
<input name="add" type="submit" id="add" value="Add">
</form>

<?php
if(isset($_POST['add']))
{

$text1 = $_POST['text1'];
$text2 = htmlentities($text1);

echo $text2;
}
?>

View Replies !
Mysql_real_escape_string Breaks , Need A Fix
I have just added mysql_real_escape_string to my _POST parsing function, and it breaks
, making nl2br() completely unable to read them... And according to php.net:

Note that mysql_real_escape_string doesn't prepend backslashes to x00,
,
, and and x1a as mentionned in the documentation, but actually replaces the character with a MySQL acceptable representation for queries (e.g. is replaced with the '
' litteral). (, ', and " are escaped as documented) This doesn't change how you should use this function, but I think it's good to know. Code:

View Replies !
Line Breaks?
A user inputs a news article into the database and then I echo it out onto the front end. However line breaks aren't kept and the text string is stripped of spacing.

So the user inputs into the textbox QuoteLorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec tincidunt. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec risus. Nullam faucibus. Code:

View Replies !
Use Of '&' In String Breaks
if i receive an '&' sign in my string via a POST variable, i lose all of the remainder of the string after that symbol. is it a php thing. i send this in a free form text field and the string breaks when it encounters the '&' sign and stores the info preceding it.

View Replies !
Cgi Breaks My Mod_rewrite
I had my sysadmin install SuPHP - so that my upload script would work properly, however now my mod_rewrite is broken. Code:

View Replies !
Too Many Breaks Lines
I'm not a php programmer but I have someone doing something for me, and evey time I edit a page a new break line is added. I will edit these pages 50 times or more a year so you can see why I need to limit to one <br />. nl2br is needed because I will cut and paste some stuff to transfer the data, and later on it's easier to add stuff. I think it can be done but he's having some problems with this. How can the <br /> lines be limited to just one? What can I "suggest"?

View Replies !
5 Upgrade Breaks $do?
that use PHP; recently the server company upgraded to PHP 5, which
breaks the site; clicking on the Crew, Navigation etc links at the top
left of the above page just brings you back to the main page. Code:

View Replies !
Line Breaks...
On my news system I made when I type into the text area and add line breaks and what then submit the form when I go to view the news story the line breaks are gone, are a result it looks like I dont understand the meaning of paragraphing.

View Replies !
Line Breaks Only
Here is what I want to do where users post forum post on my site. It will add a new line automatically if you press enter. If you use html code then it will not add a new line automatically. I know how to add new line breaks but not how to do it when a user has html code

View Replies !
Converting Line Breaks To <br /> And <p> </p>
I'm working on a blogging platform, and I'm struggling with the final output (what the end users/web visitor sees).

I've got to the stage where the data stored in the database in 100% correct.

My problem is converting line breaks to <br /> and <p></p>.

An example database stored entry:

<h2>A Testing title!</h2>

A list:

<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>

Another paragraph.

This is how I'd like it to be displayed to viewers:

<h2>A Testing title!</h2>
<p>A list:</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<p>Another paragraph.</p>

I've tried: nl2br and replacing double '<br />' to '</p><p>', but this messes up the HTML lists and sometimes H tags.

What I really want is a nl2br function that doesn't work between block level elements.

View Replies !
Question Re Line Breaks
for line breaks in the message body for correct display
in Windows email clients.

If the send fails [mail() = false], I save the message to an XML file, and
attempt a re-send later.

Is it OK to save the body with line breaks, or will this mess up
reading the file later with fgets()? How does fgets() deal with line breaks?

View Replies !
Breaks In Form Element
I have been having a whole lot of trouble trying to get this to work. I am using the code below for my Content Management system. The field 'content' is the field that needs to have the auto <br /> turned off. I am using the code below to insert pages into the database. The pages have HTML included within them and are formatted using Dreamweaver, so they look nice and neat.

After the script is done running, the page entered had extra <br />s added to it. Could someone please help me get rid of them, been looking all over the place and have tried a lot, no luck though PHP Code:

View Replies !
Parsing Lines With Breaks
Although my code working fine, all the PHP parsing seem to occupy one entire line when the page's source is displayed. Is there away to "break" lines during parsing? That way, the source won't look messy. Here's what I'm trying to say: Code:

View Replies !
For Loops.....code Breaks
I'm trying to read an excel worksheet (with more than 5000 rows and 30
columns) using PHP. I'm using the "excelreader" script I found over the
web - http://sourceforge.net/projects/phpexcelreader/.

Seems to me, the script reads the values in all cells correctly and
stores the total number of rows and columns existing in the worksheet
(For example, in the excel file I'm using - total rows: 5375 and cols:
37). The problem is when I try to print the values as a HTML table
(using two for loops), the script prints only first 236 rows and stops
execution. The following is the code snippet I use:

for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++)
{
echo "<TR>";
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++)
{
echo "<TD>".$data->sheets[0]['cells'][$i][$j];
}
echo "<BR>";
}

I've also set the script execution time to 5-10 mins using
"set_time_limit" function, but the script still ends after printing 236
rows (takes less than a minute). I spot checked the cell values by
printing values from 300 to 500, 5200 to 5375 etc. The values seems to
okay and stored correctly in the arrays. From what I understood, the
for loops doesn't execute completely and I don't understand why?

I've also created a small test script to see if the loops work and the
following code breaks...I don't see a output.

<?php
set_time_limit(300);

for ($i = 1; $i <= 5000; $i++)
{
for($j = 1; $j <= 40; $j++)
{
$data[$i][$j] = "mycell - $i$j"; //. ($i * $j);
}
}
echo "PRINTING TABLE....<BR>";

echo "<table border=&#391;'>";
for ($i = 1; $i <= 1000; $i++)
{
echo "<TR><TD>[$i]";
for($j = 1; $j <= 20; $j++)
{
echo "<TD>". $data[$i][$j];
}
echo "<BR>";
}
echo "</table>";
?>

View Replies !
Textarea Line Breaks Without Using <p>?
When submitting from a <textarea> within a form, line breaks are irrelevant - you can put every word on a separate line, and they'll all end up together. At the moment I'm asking people using my article submission system to insert a <p> at the start of each new paragraph - but aside from being a pain, non HTML-literate users don't understand why they have to do it...

So.. what's the best way to convert line breaks into <br> tags using PHP? Like this forum does, for example?

View Replies !
Line Breaks Using Php Str_replace
im building a pm system and i cant quite figure out how to make it recognize line breaks.
a good ex is using vbulletin. when u fill out teh message it remembers all your line breaks and outputs them as such. but when i made the pm system it bunches all the different lines into 1 long line.

View Replies !
PHP Line Breaks Not Showing
I am starting to learn php and I am alraedy struggeling with the basics. My PHP program is not showing any Line Breaks :-( I wrote a program "test.php". Instead of doing line breaks, he is doing everything in one line. I tried it on my local Windows machine with Apache installed as well as on my Webhoster's server.

<?php
echo " line 1
line 2
line 3";
echo nl2br ("line A");
echo nl2br ("line B");
echo nl2br ("line B");
?>

I start to feel stupid. Anybody an idea?

View Replies !
Email Messages With Odd Breaks
I'm creating a PHP form handler that will send an email to a user
based on form entries (a rather standard procedure). I've never had
any problems with this type of programming challenge before; however,
this is a very complex form. I save all of the form's data in a single
variable named $mailout and then call the mail() function with
$mailout as the body.

The information I'm sending is about 1200 characters long. I noticed
that in the email the user receives, there is an odd break at about
character 1000. It reads something like this:

Style: Red tu!
dor with attached garage

Everything else looks correct. The first 1000 characters are right and
any remaining characters are right. It's just at about character 1000
I get an exclamation point and then the data continue on the next line
(with a small indent).

I thought that maybe there was some sort of limit to the size of the
PHP variable, so I broke $mailout into two pieces, both well under the
magic size limit. That did not help.

I thought that maybe the mail() function was somehow breaking up this
message, so I created a small routine to write the output directly to
sendmail. That didn't help.

I wonder if this is a sendmail issue. Does anyone know of any reason
why I'm getting this odd break in my messages and how I can fix it?

View Replies !
Query Breaks When Field Has No Value
I'm hoping that someone can help with a query problem. I've spent some time looking around the internet but can't find any good examples (which is the way I'm trying to learn).

My basic query looks something like this:

View Replies !
Fopen And Making Breaks
Every I want to write into a file and I put a "<"br">" it prints out "<"br">" instead of a break... Code:

View Replies !
Inserting <br /> At Line Breaks?
Does anybody know how it is done so that if somebody presses enter in a textarea teh code will detect it and insert a

View Replies !
How Do I Make Line Breaks Without <br />??
I have a input form where i type in alot of text, this text is then stored in the database. When i pull the data out of the database to show on the screen there are no line breaks. The text is just printed out in one long text.

How do i make automaticly line breaks without using
, when i type in the form input? Code:

View Replies !
Line Breaks In Forms
i have noticed that when a user is typing in a form, when they do a line break

line 1
line 2
line 3

it displays as line 1rn line 2rn line 3rn, i did this:

$comments = mysql_real_escape_string($_POST["comments"]); 
$comments = stripslashes($comments);

not sure if i have done that right it stll displays the same and advice would be great.

View Replies !
Line Breaks In Variables?
I'm using this line to send an email...

mail($email2, "XXXX.com: Registration- Thank you.", $body, $headers);

Now the variable $body is quite long and needs to be formated..

so i tried this:

$body = "Welcome
This is a test
1)blahblah
2)blahblah";

Where the outcome i would expect is:

Welcom
This is a test
1)blahblah
2)blahblah..


obviously isn't formatting with '
'...  any other ways to format in variables or am i chasing a ghost?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved