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




Display Results From Text File In Multiple Pages


i use a string, eg "&&&" to mark pages in a text file. i use $count to count the above string. how can i display the contents of this file in multiple pages (by identifying the above string or any other method)?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Display Results From Text File In Multiple Pages
i use a string, eg "&&&" to mark pages in a text file. i use $count to count the above string. how can i display the contents of this file in multiple pages (by identifying the above string or any other method)?

Display Results From A Database On Multiple Pages
I am new to PHP and Mysql but am really determined to learn these techniques. I have some script that reads and displays results from the databse onto a page. However, I really wish to limit the number of results that are displayed to 10 per page and then have the next/privious links under the results. With these results, the results under the email field should be hyperlinked so that the person viewing the results should double click on the email link and send the person an email. How can i do that? I have to learn this technique.

The code is:-

Display Search Results In Pages
im doing a query on a table that searches articles from the database, and i was wondering how i could display the results as groups of ten, so the next ten search matches are displayed when the user presses a page number.

Displaying Results On Multiple Pages
I have a search query via PHP and MySQL that has list of results, but I only want to show 10 or 15 on a page. Much like Yahoo! or even here on the Devshed forums. I have been working on a system that cycles through all the results with a while loop and a counter. It only displays results >= 11 or <=20 as an example. I am passing that data (the results start point through the url) I am just worried that if the results are in the thousands this system would get very slow.Is there an easier/better way that I am not seeing?

Display Results From Multiple Tables
I have two tables, one table (article_cat) has four fields ("id", "title", "feature1", and "feature2") and the other table has six fields (articles) has ("id", "cat_id", "title", "content", "feature1", and "feature2").

I am looking to display the "title" from the "article_cat" table that has "feature1" with a value of 1. And I want to display beneath that all the "title" results from the "articles" table where "feature1" has a value of 1. I have tried this a thousand ways with no luck. Code:

How To Display Mysql Database Information In Multiple Pages?
how to display mysql database information in multiple pages? i would like to display all my member with consist of 400 people and i wan it list in mulitiple pages, and contain a "delete tick" for me,and when i click the member, can redirect me to member detail imformation. it just similiar to email pages of yahoo inbox.

Select And Display Multiple Queries / Results
Howdy all, i've been looking through various sites / tutorials and through this php book I have here to try figure out whats causing this problem but haven't had any luck yet.

The problem is that its displaying the Designation as the link url instead of the jcode. Hope i explained this well. Above this bit of code has calls the individual Catagorys, if theres data in that catagory it will display it with whats below. PHP Code:

Breaking Up Text For Multiple Pages
I was recently put in charge of heading up my company's website, and
while I have a lot of experience on the design side of things, I'm
still very new to the programming side. When I started, the website had
just gotten a revision, but the site was an utter mess, so I've been
trying to fix it up. As I've gone along, I've learned some aspects of
PHP, but my knowledge is still very limited.

Here is the problem I'm trying to fix. A backend is used to enter
information into our MySQL database, and then a page template pulls it
out to make the page. For our reviews, the PHP coding currently breaks
up the review's text so that it can be places across multiple pages.
The problem is, the way the text breaking was set up, the end of one
page and the beginning of the next are totally chaotic, with breaks
often coming mid-sentence.

Here is what I'd love: other coding automatically puts an HTML break at
the end of paragraphs, and then another in the space between one
paragraph and the next. I'd love to have the code search for when those
double breaks come up, and then break up the text after, say, every
sixth pair of HTML breaks. I'd also like the option to break the text
myself by putting in some sort of text code in the original text. At
this point, though, anything that can make the breaks more elegant
would be a huge improvement.

I really appreciate any help anybody can give me in this one. Please
remember that I know very little of PHP, and I'm not much of a
programmer anyhow, so things that you may take for granted that people
would understand about PHP, I might not know.

I tried to pull out what I thought was the current coding for the text
break. Here it is. I'd also like to get rid of the part1/part2 factor.
Before, they had the text breaking to help in fitting into the layout
around an image, but I've fixed that so I no longer need the break. So,
that portion no longer needs to be a factor.

if ($page == ""){
$page = 1;
}
$no_letters = strlen($Game_Full_Story);
$times = ($no_letters / 3800) +1;
$Game_Full_Story = wordwrap($Game_Full_Story,3800,"*#^");
$Game_Full_Story = explode ("*#^", $Game_Full_Story);
$pages = array();
for ($i=0; $i<$times ; $i++){
$part[$i] = $Game_Full_Story[$i];
if ($i != 0){
array_push($pages, $i);
}
}
$page = $page-1;
$story = $part[$page];
if (strlen($story) < 460){
$parts1 = $story;
}else{
$story = wordwrap($story,460,"*#^");
$story = explode ("*#^", $story);
$parts1 = $story[0];
$count = count($story);
$parts2="";
for ($i=1; $i<$count; $i++){
$parts2 .=$story[$i];
$parts2 .=" ";
}
}

Read And Display Japanese Text From Text File
I posted a question regarding reading japanese
text from a text file.

Well, since I solved the problem, I thought I'd post my solution for
the benefit of other people with the same problem.

The plan was to make a script to read and display japanese text. I
will use it for making a japanese proverb script and for a japanese
language study script.

Method :

I wrote a simple kanji text file (saved with UTF-8 encoding)
I wrote a simple PHP script to display the file contents (saved with
UTF-8
encoding)
I specified the content-type header for the HTML page :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

*** All files have the same encoding. ***

UTF-8 supports japanese characters.

and it works!

this is my PHP (and HTML) script :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHP : Japanese Text File Read : Exercise 1</title>
</head>
<body>

<?php

$filename="japanese.txt";
//open file
$fp = fopen($filename,'r');

//loop through each line in the file
while($line=fgets($fp))
{
//output current text file line
print $line."<br>";
}
//close file handle
fclose($fp);

?>

</body>
</html>

I know it's a very simple script, for testing purposes only. It
displays the contents of the japanese text file line by line.

The key was to save all files in the same encoding (I used UTF-8) and
to specify the encoding / charset in the HTML header (<meta
http-equiv="Content-Type" content="text/html; charset=utf-8">)

Text File Display
I have a number of SQL reports that create standard 132 column text files. The user wishes to view these files in a browser in addition to their daily printing on a laser printer.

I can handle directory structure, etc with PHP but I would like to know what is the best way of displaying these text files on screen. We can select them but they are very plain. Is there a TXT2HTML ot TXT2XML type tool that can display headings, bolding, etc without too much difficulty. I would rather not reprogram the reports as there are hundreds of them, and embedding HTML would not be an answer as they need to be printed on a regular laser.

Display A Text File On A Web Page
I have a text file that I am trying to display on a web page. If I cat
or more the file it formats and displays fine. When it comes up in the
browser it seems to loose tabs and the format gets messed up. This is
how I display the file.

$show = file("./fields/combined/$cdp$store");
$arrayitems = sizeof($show);
$x=0;
while ($x < $arrayitems) {
print("$show[$x]
");
$x++;
}

If I edit the file it has ^M at the end of each line if it matters.
Does anyone have a better idea as to how to display it?

SELECT Statement Results Into Text File
I am trying to create a text file based off the results of a query statement from a database. See code below:

$itemq = "SELECT sdlitm, sddsc1, sduorg, sdlnid, sduncs FROM F4211 WHERE sddoco = $ordernum AND sddcto LIKE '$ordertype' ORDER BY sdlnid";
$result3 = odbc_exec($connect, $itemq);
    while (odbc_fetch_row($result3)){
    $partnum = odbc_result($result3, 1);
    $desc1 = odbc_result($result3, 2);
    $qty = odbc_result($result3, 3)/100;
    $position = odbc_result($result3, 4);
    $uncs = odbc_result($result3, 5);
    $extcost = $uncs*$qty;
    $total = ($total + ($uncs * $qty));
    $filename = "$reportnumber.txt";
    $fp = fopen($filename, "w");
    fwrite($fp, "Activity Number: $reportnumber
");
    fwrite($fp, "Warranty Type: $reason
");
    fwrite($fp, "Customer Name: $custname
");
    fwrite($fp, "$qty $partnum $desc1
");
    fclose($fp);

Everything works fine until I get to the line:

fwrite($fp, "$qty $partnum $desc1
");

This line should actually print multiple lines into the text file as these are the line items from an order. There could be anywhere from 1 to 20 lines written to the text file. As it stands, the only line items written to the text file are those of the last line found on the order. The entrie script dealing with the text file are still within the confines of the while statement curly braces. How do I write these lines out in the text file??

Download Database Search Results As Text File?
Can someone please tell me how to query a database and then download results as a text file.

Avioding Expired Pages, & Carrying Data Accross Multiple Form Pages
I have a checkout/order form that consists of 6 pages, all PHP. The are linked to one another, like, after the user finishes page 1, they proceed to page 2, etc... The first two pages are submitted by a GET link, so those are not in my question. The next 4 are submitted using a <form>. Throughout all of the pages, i would probably have about 25-30 variables, things that the user has to fill out. I have two questions,

1. What would be the best way for me to keep track of all the data moving throughout the pages, like storing it from page 4, and i still need to access it on page 6.
2. I don't know if anyone could help me here, but does anyone know of a way to code around those ugly "page expired" pages, because of a submitted form. If a user needs to go back, which most likely they will, is there some sort of way for me to skip the expired page?

How To Display The Record Into Pages?
I'm having (for eg., 22 records) in my MySQL table. I want to display these 22 records into pages, each page contains 5 records. so 5 pages with each 5 records and the last page contains only 2 records, and Previous and Next links in each page.

I've used LIMIT in select statement. But i dont know how to use this exactly.

Using PHP & MySQL To Display Web Pages
I am a real novice to php and MySQL, with about a week's worth of
reading and self tutoring. I have an urgent need to publish a
database of information and need some guidance on how to do this.

This question might be more suited to a MySQL newsgroup, but since php
and MySQL seem to have become almost married to one another, and since
getting the data out and displaying it is where my problem seems to
lie, I thought I would start with this php group.

The problem is I can not figure out how to put information into a
MySQL database and get it out and correctly dislay it for the web.
More correctly I have two types of data I need to get in and out.

1. I have some web page content, not inlcuding borders, that is in
html format. So I have tried saving the html code, which looks
exactly like the code when you "view source" on a web page, into MySQL
and getting it out. I can get it out, but I have not figured out how
to make it act like html, i.e. to be interpreted by the browsers.
Instead it comes out looking exactly like html code. It is not being
interperted by the browser.

2. I would prefe instead of typing in html code for the content of a
page to type in instead the text, tables, lists, etc. Here is where
my problem lies, how do I input to MySQL relatively simple web pages
that may have a table, a list, some links, a picture?

3. How do I call up and use the data from MySQL an dget this to
display for the web?

By the way, I have been learning css, so I would like to use this if
possible. If not, i.e. if the formating mechanism for getting content
into a database precludes having it formattted by css on the
publication sie, then that is ok. I can live with that.

Splitting Select Results Into Pages In PHP
I'm new to PHP and Mysql, so I was hoping someone more experienced could help me with this one.

I've gone through most of Kevin Yanks excellent tutorial on Databases, but I haven't found an answer to my question.

I'd like to split the text results of a select command into a number of pages. I'd like to display 10 jokes on one page, and then ten jokes on the next and so on.

Anybody have any ideas on how to do this? I've been searching the web for most of the morning, but haven't really found the answer I needed and I was hoping somebody could give me a hand.

Displaying Search Results In Pages
I am implementing search functionality in a website. ( internal search).
In that I am taking a keyword as input and searching all the pages and storing
results in an array. I want to display 10 results per page. I wrote below logic for that. Code:

Retrieve And Display 3rd Party Pages
I'm wondering if you can show me an example php page that allows me to
retrieve and display 3rd party pages. I.e.,

when my php script is called as http://site/path/getit.php?file_key
it can retrieve from http://3rd.party/path2/name-with-file_key.htm
and display the result back to the browser.

I don't know php, and start to learning it. So I hope you can give me a full
php page, not a segment. I don't think it'd be too long though. Luckily, I'm
a programmer, so you don't need to comment it much, unless it is too
convoluted.

Further, if you can throw in handling of gzipped files, that'd be super.

If you have Firefox,

How To Display Data From Database In Different Web Pages?
When we get data from database by use mssql_query(),suppose the data is very large ,it has many rows, and we want display the data in different web pages like many search engines do, my question is how to do that using the same result without call mssql_query() again?

Display Number Of Records Into Pages
we are using oracle database, Oracle Select statement is not supporting the LIMIT , Is there any other way to display records into pages.

Background Colors On Display Pages
Is it possible to display table data using a while loop, yet have each output row with a certain bg color depending on a value within that row. For instance, if I'm dislaying the incomes of various businesses, I want to show the business with a positive income with a green background, and the business with a negative income with a red background. Is this possible?

Show Mysql Query Results On Pages
Does anyone have a script that will show mysql query results as paged results? This is what I have at the moment and it does not pass the results to the second page. Code:

Highlight Search Terms In Results Pages
I am trying to find a script or code that will highlight search terms output from my MySql db. I have posted a portion of my pagination page below. The pagination script provides ten records at a time.

For example, I need code, a script, or a funtion to grab the search term coming from the user and generate highlighted keywords when the keywords are entered by the user in the html forms search box.

In the code below, I have inserted sample code so you can see how the display appears. In actual practice, the $Source, $Topic, $Subtopic, and $References values come from the while(list($Source, $Topic,$Subtopic,$References)= mysql_fetch_row($result2)) { code line. Code:

Display Results
I have created a form where the number of rows are displayed based on a value from a select box. Everything works excellent this far. however I need to take it to the next step where I display the information back into the form based on values in a mysql table. Code:

Categorical Results Display
I want to take these results and display them by category. I.e. each of these results would fall into different categories like "insurance", they are maked in the database simply with a "Y" for each category that they would appear in. I could make a page like this for each of the 20 categories, but I am sure there is a better way.
<?
if(!IsSet($start))
$start = 0;
$result = mysql_query("SELECT site_name, site_address, site_image, publish FROM sites WHERE publish = 'Y' ORDER BY site_name ASC LIMIT $start,144") or die(mysql_error());
?>
<table width="100%" border="0" cellspacing="4" cellpadding="4" align="center">
<tr>
<?
while($row = mysql_fetch_object($result))
{
echo '<td width="25%" align="center" valign="top"><a href= "',$row->site_address,'" target="_blank"><img src="samples/',$row->site_image,'"width="100" height="75" border="0"></a><br><a href= "',$row->site_address,'" target="_blank">',$row->site_name,'</a></td>'
if(++$i % 4 == 0)
echo '</tr><tr>'
}
?>
</table>

How Do I Display The Results Of A Test?
i just started learning php and have a quick question. this is my code:

$a=4;
$a==7;

what i want to know is how to display the results (either true or false). i tried print($a); but it only outputs the original variable value (in this case 4).

Display Results Vertically
I am creating a catalogue-like application and I want to display the items vertically instead of horizontally. Being somewhat new to PHP, the only thing I can think of are seperate queries for each field. Is there an easier way? Here's an example of how I want it to look.

Category 1
field1: result
field2: result
field3: result

Category 2
field4: result
field5: result

and so on and so forth....

Display The Number Of Results
How can I set the classical search engine message? Found ### results. How can I count the returned results and display them in the results page? so now has the Found 5 results or any number that the result contains.

Display Results According To Distance
I have a php/mysql driven website. On my search bar I have the option of searching by zip code. I have the function to find the radius of the surrounding zip codes. But I want to display the result along with my information from the other table.

An example would be:

I want to search for ads around my zip code for a range of 20 miles. The class I have will find all the zips and get their distances plus will sort them by closest to farthest. My problem is I want to display the records according to the distance provided. I heard of doing a sort with php but I am not sure which route to go.

I hope someone has found out how to do it, because this is the only thing left to do in order to launch the site.

How To Display Data From Same Query On Diffrent Pages Using Next Link?
When i run query i am getting thousands of records and i am displayaing
a particular no. of records on a single page say 100 records then i put
a link to go on next page. when user clicks on next page the another
100 records will be displayes so should i need to run the query again
to get records from 100 to 200 records?

How Do I Display Radio Button Results?
I have a form which uses several radio buttons to enter data. It works fine
as far as entering goes, but I can't figure out how to display which button
is checked when I view the record. I could do a if-then routine but it
seems like there should be an easier way.

Display Query Results In A Table
$sql = "SELECT name FROM employee_tb;
$result_query = @mysql_query ($sql);// run the query
while ($row = mysql_fetch_array($result_query,MYSQL_NUM)){
$name = $row[0];}
// assuming i have 8 results

how can i display the results from this query in a table with 3 rows each column?

Search & Display PEAR DB Results
I'm only a novice in PHP & PEAR DB, and currently stuck in an attempt to create a "search & display query PEAR DB results" page. Here's my pseudocode:

1) Display page with a searchbox and a search button.

2) Upon hitting the search button, run sql query ... Select all fields from TableA and selected fields from TableB where field1 like "searchbox" order by field1

3) If searchbox is blank
-> prompt user to enter search value
Elseif search result NOT found
-> alert user >> Record NOT found
Else
-> display results in a table (with alternating colours for each row)

4) Able to paginate the results in something like display 10, 20, 30, etc records on the same page .... the amount of records to be displayed can be manually selected by the user (via a dropdown box) ... with Previous Page, Next Page links as well.

>> How would I do that entirely in code from scratch? I've found other tutorials on doing it but it is tailored for MySQL ... but I'm using PEAR DB... the syntax is different.

>> Since I am querying two tables based on the same search value, how am i able to concatenate both the tables search results and display it inline in the display results page?

3 Comlumn Display Results With Pagination
I have the following code that works perfectly.  I would like to add an easy pagination feature that limits the number of items, counts the number of records and makes links and pages for the next page. Code:

Display Number Of DB Results Beside A Link?
For an example, if you look at www.menupages.ie they give you a preview of how many results are found for each link.

ie:

 Ballsbridge Restaurants   (52)
 Blackrock Restaurants  (17)
 Clondalkin Restaurants  (18)
 Clontarf Restaurants  (17)

How is this achieved. I take it that it must be a select count on the DB for each row but that seems pointless, is there an easy way to achieve this?

Display Results Of Survey In A Table.
Is it possible to have them fill in a survey with about 10 form fields, then display
the results of everyone's survey in a table that can be sorted by different criteria
so new users to the site can instantly see which one of our services is better for them.

Display Only Mysql_num_rows Results #-# (or Similar)
I have this mysql database. It works great, the stuff outputs how I want. But I'm making a news website and I need to change the articles each month.

I'm putting all the articles into one database, then into each page as tables (ie: news, opinion, sports, etc.), then the articles each have their own row. On the homepage here it outputs all 5 articles from the news table, but I only want it to output result numbers (blah) through (whatever). Code:

Php To Pdf Multiple Pages
I can write a page - no problem.
when I start a second page I cannot open second page.
at the time of a page break I have tried:

php_close_page($sessionname)
php_open_page($sessionname,x-coord, y-coord)
and
php_close_pdi_page($sessionname, $pagename)
php_open_page($sessionname,x-coord, y-coord)
and just
php_open_page($sessionname,x-coord, y-coord)

It always opens and writes the first page but hangs
up when it tries to open the second page.

Multiple Pages
I am working on a php script that would allow members to post artices on the homepage. I think I have that pretty much down, what I don't know how to do is to limit the articles posted. I only want, say 10, to show up on the hompage, then users can click next page to see the next 10 articles. How would I do this? And how would I beable to make a next page link, too?

Also, this might be a bit much, but how would I make an administrator page, that allows me to authorize which articles are posted, and which are discarded? Just a simple one that says, post or delete. I can do the rest that would let me edit etc. but I just don't know where to start!

Limiting Results, And Display Page Numbers
How do I make it so only 50 items display per page. And if there's more than 50, it displays a link "page 2", "page 3" and so on? I know how to limit results with MySQL but how do I generate pages for the next 50 within the PHP code?

Display Results From Query In HTML-table
I'm working with PHP3 and Oracle 8. Can anyone tell me how to display the results from a query into my HTML-table?

Checkboxes In A Form To Determine Whether To Display In Results
I am making an effort to put checkboxes in my form that will determine whether to display that column or not. This is my first time doing this with PHP and I am hoping you gurus can assist. I have gotten some extremely great assistance in the past, so I am looking forward to any recommendations.

currently my form is as follows:

Getting Results To Display In Two Columns Of A HTML Table
How can i get the following script to display in two columns of a HTML table? At the moment i have it displaying in one column. If there are 5 results from the DB then the left HTML table column will display the 1st, 3rd and 5th result. The right HTML table column will display the 2nd and 4th results. Code:

Multiple Pages From One PHP Document
I'm trying to work out how to query a database in MySQL, get a nuumber of
listings that match some of the criteria. For example the database has a
"town" field. If the town field matches the form's town field (as input from
the user), that listing's "Title" field is printed.

This title should act as a link to the full information of the listing. EG.

The user enters "Plymouth" as the town,
The php sends a query to the database
The database says "yes we have 10 listings in plymouth" and lists the titles
of all 10 as links.
The user clicks on one of the titles named "Neil's House"
The php then sends a query to the database and prints all the details of
this listing including "Description" and "Directions" fields.

I hope that makes sense, but anyone have any ideas HOW to do it?

I have a feeling I'll need to add includes or if / else statements to only
print the whole listing if the database is certain it has the listing
required, but otherwise keep giving details until only one is listed.

Also is it possible to create an SQL database from an Excell spreadsheet?

Forms And Multiple Php Pages
I'm working on a site which has a form page for users to request information from our company. I have the form working correctly, and a php page which lets the user verify his/her input. On this page, I have a submit button which opens the next php page which sends the email message to our servers regarding the info request.

My problem is that it seems that my variables from the form (i.e. $name, $address, etc.) as well as any variables I created in my first php page can't be passed to the page that contains the mail-sending script. Does anyone know how to pass these variables on?

Multiple Pages Script
I have adapted this multiple page script and its not working anymore.... i'm sure it worked when i first installed it but i've done some pretty heavy script changes since, here the 2 parts, the first part is right at the top of the script and the second part is at the end, just before the results are given to the page parser...PHP Code:

Create Multiple Pages
how I would alter this code, which displays a list of my site pages as a single sitemap page, to generate multiple sitemap pages (like 20 links per sitemap page or something) with next and previous buttons? Trying to avoid having a ton of links on one page.. Code:

Multiple Pages Script
I have this basic php script that sort results from a database into 5,10,20,50 results a page and then divides the pages up into how many is required by the number of entries in the database...blablabla.

Ok, so I run it on MAMP server on my computer and it works great and just as planned. But as soon as I upload it to my hosting company server it doesnt work at all. http://jwcsk8r.com/iaredrunk/multiple_pages.php.

Now, the page recognizes the total number of entries and divides the required page links up properly it just seems to be the "navigation" isn't working.

I really have no idea where the difference might be in the set-up (php.ini file, maybe?) or how to correct the issue. And both MAMP and my hosting company are running php4. I think it might have something to do with the register_globals or the server variables being called improperly. (i.e. $_SERVER["PHP_SELF"] and not $PHP_Self) but ive messed around with both and cant get it to work. Code:


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