Fetching Results Across Page Loads
I would like to find a way to execute a query against an MS SQL server
and return a small number of rows each page load. However, I cannot
read all the results in during the first page load due to size
contraints.
Here are the details. A user submits a request. I construct a SQL query
and execute on the MS SQL server. The query results in a million rows.
The initial page load shows the first 100 rows. Each successive page
load shows the next 100 rows. Because our web server has limited disk
space, I do not want to return the entire result set now, but only 100
rows at a time. Also, for performance reasons, I do not want to rerun
the query each page load.
So, I need a "persistent result" set that can be fetched from across
page loads. I have tried to store the result set in a session variable
using serialize and unserialize, but to no avail. It seems that across
page loads the result set loses its way, even with a persistent
database connection.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Automatically Validating Each Page As It Loads
My whole site is PHP. That means that there are various includes which make up each page so that I can have standard headers/footers/menu, etc If the content of one of these changes, it might break one, some or all pages. I am fairly anal about validation and use W3C to validate my most important pages regularly. However, I am wondering if it is worth the overhead to run the valuator automatically on each page and if there are any errors, to send me a mail. What do you think? Is it worth the performance hit?
Help Needed - Passing Values Between Two Loads Of The Same Page
How do I pass a string from one call to a php block to another call in the same page but from another form? Here's my full php code: I'm using two forms in the same page. A hidden field 'f' with values Ƈ' and ƈ' are used to distinguish calls from one form from those from the other. <html> <head><title>Database Access</title></head> <body> <form name="QueryForm" action="db2.php" method="POST" /> <input type="hidden" name="f" value="1" /> <input type="text" width="100" name="txtQuery" value="select * from license_master;" /> <br/> <input type="submit" name="Query" value="Query" /> <br/> </form> <?php $s = ""; $nl = "<br/>"; switch ($_POST['f']){ case Ƈ': $conn=odbc_connect('mysqldsnone','root','katipatan g'); $sql = $_POST['txtQuery']; $rs=odbc_exec($conn,$sql); echo "<table width="60%"> "; while (odbc_fetch_row($rs)){ $abbr=odbc_result($rs,"abbr"); $fullname=odbc_result($rs,"fullname"); $link=odbc_result($rs,"link"); echo "<tr> <td colspan="3" background="blue.png"> <p class="white-text">".$abbr."</p></td></tr> "; echo "<tr><td>".$abbr."</td><td>".$fullname ."</td><td><a href="".$link."">".$link."</a></td></tr> "; $s .= $abbr.",".$fullname.",".$link." "; //making the comma separated string here }
Ie6 And Lower Loads Blank Page After Login
I've got a script the logs the user, then redirects them a different page. Everything works fine in Firefox and ie7. But anything ie6 or lower, after they click login, it just loads a blank page. Upon refreshing, it loads the page just like its supposed to. I read a little bit about problems with sessions and ie6, but didn't find any real solutions. I know ie is worthless, but is there any real fix for this? Code:
Having Different Results On Same Page
I have a database that I would like to use to display the contents in different lists on the same page. In other words, I would like a list of the latest 15 entries in the database to appear in list...then I would like the next 15 to appear on the same page but in a different list structure, etc. I have this so far, but it only displays the latest 15...I am stuck on how to get another list generated from the same query: Code:
Use Arrays To Page Through Results?
I've got a search facility that interrogates an SQL database then shows the results 30 at a time. Currently, when you go to the next page of results it has to run the query all over again, because there is no way of handing the resultset to the PHP file. So I wondered if there was another way of doing it. I'm tempted to use mysql_fetch_array and create a multi-dimensional array full of result rows, then hand that around, but so far cannot find out how to hand a PHP array as a variable to a PHP page. IS this possible, or am I barking up the wrong tree? Or is there a better way of doing this?
Multi-page Results....
I'm working on an engine to search a MySQL database of a bunch of forum messages. The PHP code retrieves the results from the database, then stores them into an multi-dimensional array for processing. Once stored, the code parses each result and assigns it a relevancy score, and once all of the results are scored, it then sorts all of the results according to relevance. The end product off all this is an array that holds all of the retrieved messages relevant to the search, holding such information as title, author, date, msgID, blah blah blah. now that i've kinda explained what's going on, i'll get into the problem i've bumped into. Being that there's roughly 16,000 messages in the database (not to mention the 800,000 lines of message text) that could possibly be the results from a query, displaying it all on one page is most definately out of the question (it still takes a few seconds to load on my cable line with only a few hops to the T3'd server. I'd hate to see what a 33.6 or 56k user would be waiting for). The real problem all comes down to: how am I going to pass the results from one page to the next? an array of a few thousand messages is a *little* large for an http post action, and storing the results in a table in the mysql database posses a few problems as well (namely, how long to keep the table around after the user has executed the search. temporary tables are out of the question, as they die as soon as the mysql connection is closed, but a persistent mysql connection would create exactly the opposite problem: ei, temp. tables never die).
10 Results Per Page But From Different Categories
I have a script that shows a list from a different category depending on what is in the URL. I've got it to limit the results to the 1st ten results and keep the chosen category in the link(?category=differentcategory) but when next page is clicked it repeats the same ten results. Code:
SQL Query - Results From Another PHP Page ?
Can I store this PHP code in another page, then refernece it on multiple pages using Require or Include ??? //results from sql query for ($i=0; $i<$number; $i++) { $ID = mysql_result($result,$i,"ID"); $CompanyName = mysql_result($result,$i,"1"); $ContactName = mysql_result($result,$i,"2"); $Phone = mysql_result($result,$i,"3"); $HomePhone = mysql_result($result,$i,"4"); $MobilePhone = mysql_result($result,$i,"5"); $AltPhone = mysql_result($result,$i,"6"); $SecondContact = mysql_result($result,$i,"7"); $SecondPhone = mysql_result($result,$i,"8"); $ThirdContact = mysql_result($result,$i,"9"); $ThirdPhone = mysql_result($result,$i,"10"); $Notes = mysql_result($result,$i,"11")
Getting Other Webpage Results In To Php Page
I Have a page which will take authentication from a diffrent page from a difrent website. My program needs to call a page like this from php page lets say: http://www.abc.com?handshake.jsp?us...htoken=94399843 my php page is at www.xyz.com based on this url's response i need to print the result on my php page? I tried this.. $url="http://120.126.79.21:6080/AutoPrintWeb/apvalidator.jsp?tempid=$tempid&authtoken=$authtoken&ipaddress=$rmtadd"; $fp = fopen($url, 'r'); $response1=stream_get_meta_data($fp); print_r($response1); The reukt is like this: Array ( [wrapper_data] => Array ( [0] => HTTP/1.1 200 OK [1] => Server: Apache-Coyote/1.1 [2] => Set-Cookie: JSESSIONID=B55CA82D1790D6C0A9E20ED1CEDBB1B9; Path=/AutoPrintWeb [3] => Content-Type: text/html;charset=UTF-8 [4] => Content-Length: 382 [5] => Date: Fri, 10 Mar 2006 10:22:41 GMT [6] => Connection: close ) [wrapper_type] => http [stream_type] => tcp_socket [mode] => r+ [unread_bytes] => 382 [seekable] => [uri] => http://193.186.79.21:6080/AutoPrint...dress=127.0.0.1 [timed_out] => [blocked] => 1 [eof] => ) I need only sucesss or fail..
Return Results On One Page
i have a search field on a .php page. i want to return the results on the same page i.e i dont want the action to point to test2.php but test.php which is were my search filed is sitting at the moment. how do i do this? i got this on my first page: <form method="post" action="test2.php"> Name: <input type="text" size="10" maxlength="40" name="name"> <input type="submit" value="Send"> </form> and this on the second: <?php $name = $_POST['name']; if ($name=="Friday") echo "Have a nice weekend!"; elseif ($name=="Saturday") echo "Tomorrow is Sunday!"; else echo "Please enter Friday or Saturday"; ?>
Limit Results To 20 Per Page.
I have a Database and script where it SELECT * FROM my database and lists the info on my website. I want to be able to limit the quary to only 20 per page. Here is an example of what i am talking about on this page http://sacvalleyhomes.com/Sacvalley/property_inquiry.php Everything listed under Property Inquiry is genarated be my database. As it is now i have 5 diffrent tables for 5 diffrent pages. This is way to much work to keep updated. What i want to do is put all 5 tables in to 1 table and have my php script only show the first 20 listing then generate the page numbers on the bottom or some way to view next 20 results and so on. Code:
Results Only X Number Per Page...
am doing a real state site and when searching it shows all the results from the database in one single webpage, can you help me with one easy way to show only 10 results per page? I've seen some complicated sites with previous and next arrows, i only need to show 10 results then a link to show next 10 and that's it.
Limited Results Per Page
i have a download section for my site, with about 20 downloads, and i was wondering if their was a script so that it would only show 5, and clicking 'next' button would show the next 5 etc.
When Does The Php Interpreter Loads The Php File?
I'm wondering three facts about php, apache and apache module. 1.How can i differentiate the php intepreter if it's running as a apache module or as cgi? 2.When does the php interpretor loads the php file to main memory? 3.and till when it keeps the php file on memory? - in my experience only after installing Zend it caches the php file.
Search Form And Results Page
I have a table called "lista" into my mysql database.This table has 5 text columns : "TRANSLATEDTITLE" "ORIGINALTITLE" "ACTORS" "DIRECTOR" "YEAR" , and 1 image column called "COVER". I want to create a page with a form to search entries into this table (ex. with Title, Actors, Director, Year), and anotger php page with the search results shown inside, everyone with a link that opens a pop window (ex. 400X320). Code:
Displaying X Number Of Results Per Page
What I need to do is this. I query a MySQL database and, for example, 400 results are returned. I can get it to display the number of results, but I would like to set a value to display, say 20, results per page and generate numbered links with and offset to browse through and next/previous buttons -not unlike this page. Can anyone point me in the direction of a good article or if you have it, post some code here?
Newbie Question: Results By Page
How do I make results that I select from my database on different pages based on length? For instance, say I have over 50 records with more being added and I want it to display 10 records per page. How do I get that info to display only 10 at a time instead everything all in one page?
Return Search Results On Same Page
I'm struggling with this much longer than I think I need to, How do I make the results of a search display on the same page as the search, sort of beneath the 'submit' button? Thanks for helping out.
Page Navigation From Search Results
I have created a search form that searchs for results from my database matching the criteria to what ever the user inputs. I have done this using 2 php pages the first page points to the second, where the data is sanitised and cleaned accordingly. The results are displayed on the 2nd page. Code:
Apache 2.0.50 Php 5.1.2 - Modules Loads But Scripts Don't Run
I've compiled php 5.1.2 on a Madrake 10.1 box as an apache module. I have the following in my apache conf file: LoadModule php5_module /usr/lib/apache2/libphp5.so AddType application/x-httpd-php .php The module is definately loading...I get this in the error_log: [Fri Feb 10 15:24:03 2006] [notice] Apache-AdvancedExtranetServer/2.0.50 (Mandrakelinux/7.6.101mdk) PHP/5.1.2 mod_ssl/2.0.50 OpenSSL/0.9.7d configured -- resuming normal operations So obviously the module is loading. When I try a simple test.php via apache, it sends the browser the text of the script as mime type application/x-php (which appears to be the mime type from apache-mime.types). I've done this countless times on other distros. What am I missing there? I thought those were the only two pertinent lines in the conf file.
Strange Problem: IE Loads Forever
I have a very weird problem here. I want to use .php to create thumbnails. For this, I use the following code: <? $file = isset($_GET['file']) ? $_GET['file'] : exit; //Load the image $src = imagecreatefromjpeg($file); if($src) { $width = ImageSx($src); $height = ImageSy($src); $maxwidth = 140; $maxheight = $maxwidth / 1.333333; if($width > $height / 1.333333) { $newwidth = $maxwidth; $newheight = $height / ($width / $newwidth); } else { $newheight = $maxheight; $newwidth = $width / ($height / $newheight); } $dest = ImageCreate($newwidth, $newheight); ImageCopyResized($dest, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); header("Content-Type: image/jpg"); Imagejpeg($dest); exit; } ?> This file is called showthumb.php.
How Do I Return 10 Results Per Page Using SELECT Statement?
I'm wasn't sure whether to post this under the PHP or under the MySQL section of the forums. Since most people (I'm assuming) who write PHP script, also use MySQL, I thought I'd stick with PHP. I'm rather new to both PHP and MySQL and I'd be very grateful to anyone who can help me solve a problem I'm having at the moment. First, I'll give you an introduction to my little project... I'm developing a database in MySQL that is used to store the song titles of all the MP3s I have on my PC. I've written a basic search feature that works well. The user has 2 options: Either he can type a special "!ALL" "parameter", that I made up, to return all the songs in the database or the user may enter a few characters in the textbox and select "song title" or "artist" etc. from a dropdown to search for a specific song title or artist etc.. Hope you are following so far? Say for example the user presses submit after typing "!ALL" to return all the song titles - there could be hundreds of results. What I want to do now is display 10 results on a page, then on the next page another 10, etc. (like a real search engine!). I've tried doing it with the LIMIT statement, but like I said I'm new to this and discovered that that is not the right way of going about it. My question is this: how would I go about returning 10 matches per page? Do I use hidden form fields? What would the SELECT statement look like? What would the PHP scripting look like to setup the "back" and "forward" navigation between the result for the search?
Displaying X Number Of MySQL Results Per Page
I'm writing a search on a MySQL DB, and everything so far has just gone swimmingly. I've got a "results per page" drop down box in my form, with a few different values. At the moment, I'm just using: while($myrow = mysql_fetch_array($result) to output results to screen. I'm not too sure how to go about it, but I did have two thoughts: 1) Suck the results into a multi-dimensional array, and pass the array to a display results script (not sure if you can pass arrays to other scripts??? 2) Display x number of results, then have the "Next" (or 2, 3... ) links call the search again, but displaying results x+1 - x+x. 1 sounds like too much trouble, and 2 sounds inefficient. Not too sure how else to go about it. Any info / thoughts you guys have would be much appreciated. On a side note, how do you look at a specific row in the result?
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?
Link To Form Results Page Dynamically
I have a dropdown box that pulls information from a database. What I want to achieve is that when a caller selects an option, the option determines that page that comes up. I tried setting the form action to the name of the option, but this down not bring up anything; actually the resulting page is .php. I also tried moving the form action statement after ther selection, but that does not work either - the Submit button does not work. PHP Code:
Search Results Showing An Include Page
I have a page index.php which includes different templates based on a passed URL variable through the include() function. My problem is that I have the files saved as temp.inc.php files. Search engines are returning the include page as a result and then the user is directed to a new window with just the include page displayed. Any ideas on how to get around this?
How To Pass Mysql Search Results From One Page To Another
I am creating a website that uses PHP to query a MySql database. upon supplying the PHP script with a given search string and search term, a list of scientific documents with attributes such as author, date, url and revision are returned. Each document also has a unique id number within the database. What I would like to do is create a system whereby user of the site can leave reviews for each particular document, much like the product review system employed at jungle.com. I have got to the stage where the php script outputs a list of results each separated by a horizontal rule and what i would like is to be able to place a button on each record marked submit review, which would then take the user to a form where he or she could leave a review which would placed into a reviews table in the database. However my problem is that i do not understand how to pass the paper id automatically to the form such that the user does not have the inconvenience of having to type into the form. Does anyone have any ideas on how I could solve this problem?
GD Image Loads And Then You See White Line Go From Top To Bottom
i have a gd image that loads and once it is clicked a pop-up will open and display the image again only at a bigger size. i am not resizing the image with gd; i am resizing with regular html image tag's width and height properties. when the initial gd image loads for the first time; it loads normally, but when it loads in the pop-up window; it loads normally and then it is like it reloads itself again, because you can see a white line go from top to bottom of the image. i do not know what is causing this; i was wondering if the gd image is being cached by the browser and displays at first; then the gd code loads from the php script and the white line is because the background of the pop-up is white and the cached image is being reloaded from the php script. any way - anyone have any ideas? - anyone know how to prevent this? - would i us a no-cache header?
Populating Form From Database, Then Passing Results To Next Page
I have a multiple select input in a form that's being populated by a row from my database as such: <input type="checkbox" name="subm[]" value="$row[ID]"> That part is working fine as I can check the displayed page using View Source and see that the value is the correct row number from the database. It is then being submitted on a form by $_POST method to another page where I want to evaluate the checkboxes and display the contents of the entire row that corresponds to each value="$row[ID]" that have been checked. But I can't seem to get it to work. I'm having a problem passing the selected value. Can someone point me in the right direction? $query = ("SELECT * FROM `table`"); $result = mysql_query($query); print "<p>Data for Selections:"; print "<table border=2><tr><th>You chose:"; foreach ($_POST['subm'] as $value) { print "<tr><td>"; print "$row[ID]; "; print mysql_field_name($result, 1) . ": " . $row[name]."<br>"; print mysql_field_name($result, 2) . ": " . $row[address]."<br>"; print mysql_field_name($result, 3) . ": " . $row[city]."<br>"; print "</td></tr>"; print "</table> "; } if (!isset($_POST['subm'])){ print "<p>No matching entry "; } mysql_close();
Web Fetching
i have a page that was premade and i dont like it but some stuff on it is useful and i want to grab just it and include it on my home page the stuff i grab would be in html css and javascript so my question is does any one know how i would go about doing that.
Web Fetching Script
I am using the following script to fetch data from a webpage and saves in my file "news.htm", this page changes its url frequently, what I want is to tell the script to try another url if the first one does not work: PHP Code:
Fetching Web Pages
i need to write a php script that fetch web pages and use proxy authentication (i use LWP in perl). anyone can shed some light on where to start (pointers, tutorials, source code, etc). a simple example would be great.
Fetching Variables
I want to make $room_id = $_GET["room"] BUT i need it called on another page. How can i do this? I.E. http://www.domain.com/index.php?room=2 $room_id = 2 ^^ Now i need $room_id 's variable to transfer to another php file... that is not called directly by the url.. any suggestions?
Web Content Fetching
I have read the forum rules and checked out the sites listed as having possable answers to my problem but no luck. Here is my problem at the moment. I have a php script that allows me to place information into an image, All in the hope of creating a site that grab content from another site and display it in the image in the form of a forum signature. I have checked out a few web content fetching scripts but they dont seem to give me quite that I need. So basicley this is what I am hopeing to acheve. 1) A script that can fetch certain words from another site e.g. "Username: Dreg" I would like to fetch the word "Dreg" 2) I would like to be able to get the username and turn it into the value $user 3) I would then like to be able to use that value anywhere on my site. If this is not possable then thanks for your time!
Fetching RSS Content?
I am making an automated minisite, I found a tutorial but it uses Magpierss to fetch the feed content and Magpierss wont work for me. Is there a simple code that will allow me to fetch the Title (linking to the original article), Description and Date Posted? And put them all into my PHP website?
Fetching Http Address ?
I used PERL and to fetch at URL address, I would use something like this: sub geturl{ my ($url) = @_; my $page_returned = ""; use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->timeout(30); my $req = new HTTP::Request GET => "$url"; my $res = $ua->request($req); if ($res->is_success) { $page_returned = $res->content;} return $page_returned;} I want an equivalent of it in PHP, is there any?? what I basically want to do is write a script that will be able to request a HTTP address, for example: $url = "http://www.google.com"; then a code to fetch ($url).
Magpie RSS - Fetching HTTPS
I am using Magpie RSS and want to be able to use feeds on a secure server. At the command line, I can fetch this file using: But Magpie RSS can't fetch it and gives: "PHP Warning: MagpieRSS: Failed to fetch I have had a look at the Magpie code and it seems to use the cURL -k option too - but it seems to be unable to fetch the feed.
Fetching Mails From Hotmail
I am currently trying to make a script that fetches mails from MY hotmail account from a certain Email. Is this possible with PHP ??
Fetching Array From MySQL Table
Some told me to better learn some basics of php and mysql, but i encountered a problem that i couldn't solve with all the tutorials out there. I tried the following code to fetch an array from a MySQL table named Gallery: PHP Code:
Advice About Fetching User Information
I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other things. So, in instances where I list, for example, the latest weblogs. I list the headline of the weblog, the date and the name of the member who wrote it. Now, the name isn't just "Smith", but rather Smith's online status, his nick and his "label", and can look like this: <imageSmith M:34 The image is either a green or red dot depicting his online status. When I want to display this, I use this function: print member_name(12); With 12 being the id number of Smith, and the only information about the writer of the weblog (i.e. I don't save his nick or label in the weblog post, and certainly not his online status). So, when using member_name() I look up the id 12 in a prefetched array of members, displaying the correct information. In a compact format: ## index.php require_once("member.php"); print member_name(12); ## member.php $q=mysql_query("select id, name, label from members"); while ($r=mysql_fetch_assoc($q)){ $GLOBALS["members"][$r["id"]] = $r; } function member_name($id){ $m = $GLOBALS["members"][$id]; $online = in_array($id, $GLOBALS["surfers"]) ? "on" : "off"; return icon("online/$online") . " $m[name] $m[label]"; } ## So, whenever requiring member.php, all members are prefetched and put into $GLOBALS["members"], which has worked just fine. Then I have infromation about any given member at my fingertips. But now I have some sites which are beginning to get a pretty large number of members, so prefetching them all becomes timeconsuming (sometimes up to one second, which is unacceptably slow). I can't fetch information about each single individual at the point of showin his or hers information since there can be long lists of for example weblogs and there might be 40-50 member names to be shown, which would result in 40-50 seperate mysql requests, which would flood the MySSQL server, I'm afraid. So, my question is this; what other way can I do this in? Is there a faster way to read thousands or even tens of thousands of information points and put them in an array quickly? Or is there a better way to read information about single members at runtime? Aggregation is most certainly an option. Can I write a tab separated text file and read that one in member.txt - would it be faster? Should I write one text file per user and read that file when needed? Anyone got any experience in doing this? How did you solve it?
Fetching And Managing Mime Mail
Is there a nice tidy php class that will allow me to fetch mail from a pop server and break up and retrieve the different mime parts and such... that is at a higher abstraction than the more simpler imap_ routines found in php? Basically I want mime and pop/imap management past the simple facility provided by php.
|