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




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:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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 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.

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:

Displaying Select Information From XML Search Results
I am new to both php and xml. I have a school assignment to update an existing php-based website where I have to display search results from an online library. I can use a url search which returns an XML file that includes tags such as position, title, url, description, date, etc.

I only want to display the title, url (preferably the title should be a link to the url), and description for all of the results on my website's search results (different template as well).

What classes/functions are available to help me do this? I would appreciate any guidance as well as links to online tutorials etc. that would point me in the right direction. I have read about the general aspects of php, and I have experience with Java and C; but I don't know about xml at all.

By the way, the website is running on the school server and has php version 4. I don't think I'll be able to install php 5 but I can probably upload some helper files or something.

Search Results ($num_rows) Does Not Match $search Results (PHP,MySQL)?
For example, when I do a database search for a term I get 2 results but the $num_rows says there are 3 results.

I suspect it's because there are similar keywords within different search fields of the SQL statement. But I am stumped as to how I can change this. Any Suggestions? the code:

Help With Displaying Selecting A Date Range And Displaying Results
I wish to create a simple form that allows the selection of a start date and a stop date with the ability to select what columns to be displayed in the result page.

Search Brings Back Different Results Or Sometimes No Results
The problem Iv got is that when searching the site - it brings back different results or sometimes no results. For example: "i026", "i 026" and "026" do not bring back results for "I-026" which is the correct model number. Any ideas on how to make it search more variations or of a "Did you mean... I-026" script?

Highlighting Of A Search Term In Search Results
I am writing this simple MySQL and PHP search and what I want to do is to highlight the search term in the results when they are displayed on the screen.  I am able to get it to work. but the seach term will only be highlighted(Make it Bold) only if it matches exactly to what was typed in the search box. 

Is there a way where the search term doesn't have to exactly match in order for it to be highlighted?  Below is the code where I change the the search term into bold to be displayed on the screen.

<?php
$result_manufact = str_replace($splitstr, "<span style="color: red; font-weight: bold;">$splitstr</span>", $manufact);
?>

I Want Search Script Which Can Search All Pages Under Given URL
I want search script which can search all pages under given URL...
because i want to search my text in given website (like Google's
Domain search)

Displaying The 10 Most Viewed Pages
I built a page view counter that collects the page id (comicId) and the user's IP addresss so it doesn't get counter twice.

I would now like to display the top 10 most viewed pages. I need to get a total count of every time the comicId appears in the table and display the ten highest totals.

I tried using

<?php $tabsOne = mysql_query("SELECT *, COUNT(*) FROM comicCounter GROUP BY comicId LIMIT 0, 10") or die(mysql_error()); ?>
But I don't think this is the right path. Any ideas?

Displaying Limited Results
I have a problem that is related to limiting the results displayed in a page. I have a numbered pagination script working that has a limit etc. At the moment it is milited to displaying 8 results before producing the next link.

What I have is a table with 2 columns and 4 rows....a grid of 8. I want the results to start in the top left and then when 2 table cells have been created it will start a new row and do this for all of the results ie:

1 2
3 4
5 6
7 8

Basically, i need code that will make a new row start when 2 results have been displayed in that row.

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.

Help With Function For Displaying Calculation Results
I am developing a betting calculator and at the moment I am working on some functions that can be used to display the HTML for the form to enter your bet and odds and the results.

I am still relatively new to PHP and I am learning all the time so sorry if this is a simple problem!

I have 3 files: calc1.php, index.php and funtions.php

Here is index.php PHP Code:

Nesting Queries And Displaying Results.
i am in the process of trying to make a simple system to keep track of switch ports and what points they are conencted to. the problem i am having is with displaying the data from my ports table. Code:

mysql> select * from Switch_Ports;
+------+----------+---------+------------+--------+
| SwID | Port_NO | VLAN | Patch_Port | PortID |
+------+----------+---------+------------+--------+
| 1 | fa1/0/1 | staff | AA10 | 1 |
| 1 | fa1/0/2 | staff | AA12 | 2 |
| 2 | fa1/0/10 | staff | AA100 | 3 |
| 2 | fa4/0/12 | staff | BB12 | 4 |
| 3 | fa2/0/11 | student | A16 | 5 |
| 3 | fa1/0/23 | student | B14 | 7 |
+------+----------+---------+------------+--------+

SwID relates back to my Switch table, which contains dns names and stuff like that. for example i want to be able to display the ports from SwID 1 PHP Code:

Displaying Array Results In Table
I'd like to display the results of an array in a table format with the Alias, Alias Destination & Username as column headings & the results underneath. PHP 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?

Displaying Database And Getting Unwanted Results...
I want to display everyone in the database, but only if the 'level' field is larger than 0.  Well, this works fine for most of the database... but if the last entry in the database is 0, then it prints it anyways.

Is there anyway around this?  I tried adding an if statement before the last bit where I echo out the table rows, but it was killing the entire table, or still showing the same results. Code:

Displaying Results With Decimals, And Stylizing Them.
I just have what I think is an easy question for some of you. I have a page that pulls all the entries from a specific table in the database. The results are displayed in a table. In this table there is  column for "job_number" this job number is a decimal entry, i need to display the job numbers, grouped by the the numbers ahead of the decimal place and then ordered by the numbers after the decimal. I would also like to indent the decimals ONLY numbers below the under that does not have a decimal. Code:

Displaying Results From Database In A Particular Format
How do I display results from a database in a particular format.  For example the following text in this format including the lines in stored in the database:

Quote“Hello,

Welcome to the news for 11/06/07.

Thanks”
When I echo the results using the usual, <? echo $row_news[‘news’]; ?> it doesn’t echo the information in the database in the format it is stored for example it will display like this.  Quote“Hello, Welcome to the news for 11/06/07. Thanks”  How do I get it to display in the format it in displayed in the database?

Displaying MySQL Results As URLs
I'm attempting to turn the results of a query into urls, yet I keep getting this error, "Parse error: syntax error, unexpected '<' in staff.php on line 190." I've coded and recoded this, yet for some reason I cannot get this error to go away. I know it's probably simple, but what am I missing? Code:

Search Pages
I am making an application that lets you upload pics to a server and also adds the directory to a DB. Now I just need to display the pics and I want to do it a page a picture. Kinda like a search page. AV or Google style. But instead of a link its a pic and then you can choose to go to the next one by clicking on a link. But the whole time it's one dynamic page pulling info off of a mySQL database.

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:

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:-

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?

Displaying SELECT Results In A Formatted Table
I was wondering how to show a table with a max limit of 20 results per page. I have various data being pulled and its putting it in a table, but its displayed all in one row. I want to format it so its a 4 column/5 row table. With that I then want the page to generate a numbered list at the bottom that calculates how many pages it takes to show 20 items on each. Code:

Displaying SQL Query Results In 3 Column Table
I would like to be able to display the results of an sql query in an html table, but the results need to be displayed in three columns, for example:

Column 1   Column 2   Column 3
Result 1     Result 2     Result 3
Result 4     Result 5     Result 6
Result 7     Result 8     Result 9

I've tried to find the answers on the internet but i can't find anything that suits my needs!

Splitting A Search Into Pages
After trial, error, 2 days reading about PHP and some fine Single Malt,
have finally created a search from a database with multiple criteria as
below.

NOTE comments on tidying the code up are welcomed.

BUT.... if I want to split the search into groups of 10 and then (like
Google) prompt for page 2 of 10, 3 of 10 etc.

Anyone know of any tutorials on this?

<?php
$result = @mysql_query ("SELECT name, townname, town, townid, photo
FROM site01_towns, site01_details WHERE townname='$townsearch' AND
town=townid AND code='sleep'");
while ($row = mysql_fetch_array($result))
{
$photoname = $row['photo'];
$company = $row['name'];
?>

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="400"
height="95">
<tr>
<td valign="top"><?php echo '<p>' . $row['name'] . '</p>' ?></td>
<td valign="middle" width="140"><img src="images/<?php print
$photoname; ?>" border="0"/></td>
</tr>
</table>
</center>
</div>

<?php
}
?>

PHP Pages And Search Engines
I am in development of my site and alot of the site has php3 pages. What i need to know is, does search engines index PHP3 pages?

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 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)?

PHP Generated Pages & Search Engines
I'm trying to get a basic idea of how well PHP generated pages can be spidered by search engines? I'm working for a company that keeps two versions of it's site at the moment. One copy run off of a database using CGI, and one copy entirely in HTML so search engines will find them. I've told them that this is just a bad idea, and far too time consuming. I'm under the impression that PHP pages can be found by search engines, am I wrong? I'm going to be running almost their entire database of products off of one file, will the search engines be able to find these if there aren't direct links to them?

Any other suggestions as to how to keep their positions in the search engines (very good right now) would be appreciated as well.

Dynamic Pages Vs Search Engines
I have a how-to-do-it manual like site,
related to fishing. I want to add a new
interactive question/comment feature to each
instructional page on the site.

I want (registered) users to be able to add
comments at the bottom of each page, similar
to the way the php, mysql, apache manuals work.

PUNCHLINE_A:
I don't want to revert to a system of dynamic links
that look like "pagePainter.php?page_id=123"

I did that for a while. But every time I edited
the site (reloaded the database) all the page_ids
changed, and then voila I had stale links spattered
all over my Google search results--because the
same page now had a slightly different page_id.

To avoid that I could associate each page with
a unique lookup string that is its server-side file path:

pagePainter.php?page_key=/pages/manual/chapter1/engine_repair/carburetors

Then the keys wouldn't change everytime I added a few new pages
to the system, and reloaded the database. Then my Google search
links would remain constant.

PUNCHLINE_B:
Will the search engines spider and index links that look like that?
Or will I have to make a system that spits out the entire page as static
html, each time a registered user adds a new page question or comment?

Or should I put the comments box in an iframe, which is also a spidering
can of worms?

Dynamic Pages With Search Engines
We know search engines cannot index many database-driven pages basically any page with a '?' or '&' in the URL, and i want to ask if is there en way to transform that simbols in / for example.

Want PHP Code To Search All The Pages In A Website
i just want to know some code that would retrieve all the pages fron a given website with... that when i give a wesite to code it fetches all the pages in that and make a list for all with address.

Is This Possible With Search Results
Is it possible that when someone does a search on your database, that the results are downloaded as a text file?

Is Anyone Else Able To See My Search Results?
Here is the thing. When you go to this page:

http://www.accumulist.com/index.php...llFields%5D=api

I've put in some HR tags in the HTML to separate the 3 different
queries. After those 3 queries you'll see results at the bottom. For
me, those results look like this:

api (4), darren (1), xml (12), battlepanda (1), war+on+drugs (6),
stupid (1), moron (1), nightmare (1), hell (1), mijkuynbvfsds (1),
police (1), Pitchfork+Media (1),

There are two problems here. Do you get this when you go to this page?
I'm concerned that I'm only getting back the things that I have
personally searched for, and not the things that others have searched
for. Let me know, please, if this works for you.

The goal of this script is to be able to say to the person who is
searching "People who searched for this item, also searched for these
other things."

It is suppose to be a little like on Amazon.com, where when you buy one
thing, it says "Customers who bought this item also bought these other
items:".

I'm sorry I didn't give the table structures earlier. The visitor id of
searchHistory is the id of visitors. machineId is a unique value
generated and set by a cookie.

#
# Table structure for table `searchHistory`
#

CREATE TABLE `searchHistory` (
`id` int(11) NOT NULL auto_increment,
`query` text NOT NULL,
`visitorId` int(11) NOT NULL default &#390;',
`domain` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=88 ;

#
# Table structure for table `visitors`
#

CREATE TABLE `visitors` (
`id` int(11) NOT NULL auto_increment,
`date` int(11) NOT NULL default &#390;',
`ipAddress` varchar(15) NOT NULL default '',
`hostname` varchar(255) NOT NULL default '',
`machineId` varchar(255) NOT NULL default '',
`referrals` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=8236 ;

Search Results
whenever i do a $result-$row query and try to list the results with a while statement, it always cuts off the first result. how do i fix this?

Retrieving,Sorting & Displaying Multiple Results From Mutliple Tables
I need to know how to run a php / mysql query to do the following.

I have 1 database (lets call it "database" for now) within this database there are multiple tables ("News","Feature","Header_feature")

For NEWS I need only the 6 latest results pulled from that table and displayed in a table.  The "News" table has the following columns "ID","Title","Date","Body","Image"

For Feature I need only 1 result retrieved from the database and displayed under the variable $ticker as it will display as a scrolling marquee within a table.  The "Feature" table has the following columns "ID","Ticker".

For Header_feature I need only 1 result retrieved from the database and displayed in the following manner <a href="$link"><img src"$header_feature">[/url]  The "Header_feature table has the following columns "ID","image","link"

How would I code this all into 1 page?  I cant seem to get the query to do everything I want it to and display the results properly.  You can see what I have so far at www.getlivemedia.com  The $ticker is the scrolling text near the top of the page and the news is obviously the bulk of the page and $feature_image is the broken image.

Database Driven Pages On Search Engines
I know this has been discussed at length in these forums from the searches that I've done, but I have a new question of sorts. Basically, I found several solutions to the problem of using PHP/MySQL database driven pages and getting them listed on search engines. One method that I've chosen entails listing the variables in between backslashes after the name of the document, like this http://www.something.com/index.php/test/1234

After a few problems, I've been able to get all of the pages in the first group (I just added the 2nd and 3rd group today) to list perfectly on Google. I'm psyched about this working on my entire database of 10,000+ products, but I'm worried that I may be overlooking something.

If possible, please check out that link and if anyone knows of any shortcomings or pitfalls with using this method, please let me know. Thanks a ton.

Distribute Search Result In Pages - Pagination
How can I distribute a search result in different
pages? For example I have 10 search results (searching
for database) and I would like to get 7 results per
page. So there will be 2 pages, first 7 results in
first page and rest 3 results in second pages. I am
just simply querying from the database.

What will be the best and easy sollution?

Crawling Google Search Result Pages
I want to make a crawler in php that will crawl google search results for given keywords. Procedure will be something like this:

1. There will be a list of thousands keywords in file with csv or other format.

2. Crawler will crawl google.co.in for each keywords in the file.

3. Top 10 results title, description and the url will be collected and stored in MySQL database.

4. Now crawler will crawl for next keyword after some delay and loop will go on unless reach to daily limit of keywords to crawl. Then next day it will start again.

I need some suggestion on:

1. How to crawl pages without using any addons.
(Because I am going to run this from an free server not my machine so I will only have php, mysql and general features. )

2. What kind of parsing I should use to extract title, description and urls from HTML code.

3. What should be the delay and daily crawl limit. ( I don't want to get banned by google for automatic query. )

Links From Search Results
Hi i was wondering if anybody could tell me how to make url links to an item in my site from a list of search results. Here is a piece of my code:

<?php
$Name = $HTTP_POST_VARS["query2"];
$Eventtype = $HTTP_POST_VARS["query2"];
$EventStart = $HTTP_POST_VARS["query2"];
$EventEnd = $HTTP_POST_VARS["query2"];
$VenueName = $HTTP_POST_VARS["query2"];
if($Name or $Eventtype or $EventStart or $EventEnd or $VenueName)
{

$conn=@mysql_connect("mysql", "u0rr")
or die("Sorry can't connect to database");

$rs = @mysql_select_db("u0rr", $conn)
or die("Sorry can't connect to database");

$sql="select * from event left join venue on
(event.VenueID = venue.VenueID)
where (Name like '%$Name%'
or VenueName like '%$VenueName%')
AND Eventtype = 'Comedy' ";
$result=mysql_query($sql,$conn);

while( $row = mysql_fetch_array($result) )
{
echo("<b>"." Event Name: "."</b>".$row["Name"]."<br>");
echo("<b>"." Event Type: "."</b>".$row["Eventtype"]."<br>");
echo("<b>"." Venue Name: "."</b>".$row["VenueName"]."<br>");
echo("<b>"." Event Start: "."</b>".$row["EventStart"]."<br>");
echo("<b>"." Event End: "."</b>".$row["EventEnd"]."<br>");
echo("<b>"." Availability: "."</b>".$row["Availability"]."<br>");
echo("<b>"." Description: "."</b>".$row["Description"]."<br><hr>");
}
}
?>
For example if i enter an event type as 'comedy', a list of search results will come up from the form input displaying comedy events. Now from these results i would like to be able to click on Venue Name and this would link to that page in another part of my site.

I hope this explanation is o.k, if not post a thread & i'll try and explain a bit better. Thanks for any help

How Do I Underline My Search Results?
This is a PHP/MySQL question.

I have a search engine that finds matches of a word in artist names, and their album titles. How do I underline the word that is matched when I display the results? I've seen this on Yahoo! and was wondering how to do it.

Multiple Search Results
I have a php script which searches a mysql database and returns and lists the results 25 records per page. I am using the offset to do this. It works well. But I am outputing the search results 1 record per line, 25 records per page, with links to the previous and next pages, etc.

What I really want is to list the results in a 5 X 5 table. ie the first 5 records on table row 1, the next 5 on table row 2, etc.

Obviously for the last page there may not be 25 records, but anything from 1 to 25.

How can I automatically output html to produce the table and populate each cell with a record from the search result?

Links From Search Results
i was wondering if anybody can tell me how to make a url link to another part of my site from a completed search result. here is a section of my code i would like to link from.

echo("<b>"." Name: "."</b>".$row["Name"]."<br>");

Printing Search Results
How would I go about printing a list of search results? I have my query down fine:

<?php
$query = "SELECT data1, data2 FROM table WHERE name = '%$var%' ";
$result = mysql_query($query);
?>

I need to know what to do after this so that all results are printed in a table that includes 'data1' and 'data2'. I'd imagine this is done using 'while()' loops but I've never worked with one before and especially not in this context.

Search Results Substring
I have been searching for some clues as to how to show a substring from a
database search.

$pagetitle = "Page Title";
$pagetext = "This is <b>a typical</b> string that would be stored<br>in the
database.";

Search for "that" results would look like

1. Page Title
...string that would...
2. Another page
...computers that can...
3. Further Page
...languages that are...

At the moment the search results just show the page title. The idea is that
in the set of results I can show the user the context of each result, a bit
like a search engine does. Ideall I would like up to 10 words either side
of the search keyword.

Counting Search Results
I would like to know if anyone can show me how to count search results in a MySQL database for a keyword ($keyword).

Posting Search Results
i am a bit stuck on this part of coding, when people search ALL categories i leave the option value as: <option value="0"> so if 0 is passed to the GET all categories should be searched instead of just category 1,2 or 3 etc Code:


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