Search found 22 matches

by csingsaas
Thu Feb 01, 2007 9:38 pm
Forum: Databases
Topic: Compare MySQL Result Sets
Replies: 5
Views: 683

Well I know how many results are returned that match the search criteria. So, the size of the result set for query A is 10 (for instance). I want to then select 5 featured ads totally at random for query B. I could put the sql query in a loop and run through it five times. If it comes up with a reco...
by csingsaas
Thu Feb 01, 2007 9:18 pm
Forum: Databases
Topic: Compare MySQL Result Sets
Replies: 5
Views: 683

The main reason I would avoid implementing your suggestion is that I want to make sure there are 15 results showing. If I come up with 10 qualified search results and then perform the second query to get the remaining 5, the second query may contain duplicates. If I filter them out during the proces...
by csingsaas
Thu Feb 01, 2007 8:39 pm
Forum: Databases
Topic: Compare MySQL Result Sets
Replies: 5
Views: 683

Compare MySQL Result Sets

Example: I have a form allowing customers to search for a used automobile. The form has the following fields: Car Model (pull down menu) Car Color (pull down menu) Car Year (pull down menu) Car Features (multiple select menu) Max Price (text field) The customer must search using at least one of the ...
by csingsaas
Mon Nov 27, 2006 7:08 am
Forum: Databases
Topic: Help ordering MySQL query results
Replies: 5
Views: 687

No other way? I was hoping I could define the order something like:

Code: Select all

ORDER BY horse_adtype('F','P','X')
by csingsaas
Sun Nov 26, 2006 9:39 pm
Forum: Databases
Topic: Help ordering MySQL query results
Replies: 5
Views: 687

Help ordering MySQL query results

feyd | Please use , and [syntax="..."] tags [u]where appropriate[/u] when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color] I ...
by csingsaas
Sun Nov 26, 2006 8:00 pm
Forum: PHP - Code
Topic: Use session variables or multiple sql queries?
Replies: 2
Views: 624

Use session variables or multiple sql queries?

I am writing a script to search a database I have put together. There will potentially be thousands of records. If someone did a rather broad search, there could be 2,000 to 3,000 matching records. The results will be displayed 15 per page. The search window allows the user to define up to 5 differe...
by csingsaas
Sun Nov 26, 2006 6:52 pm
Forum: PHP - Theory and Design
Topic: Display randomly ordered MySQL query results on mult pages.
Replies: 12
Views: 3599

That is very very useful. Thanks! One last question. What is your opinion on what is more taxing on system resources, using session variables or incorporate more sql queries. I now have the option of either saving all of the search results in session variables and displaying them on subsequent pages...
by csingsaas
Sun Nov 26, 2006 5:48 pm
Forum: PHP - Theory and Design
Topic: Display randomly ordered MySQL query results on mult pages.
Replies: 12
Views: 3599

I'm using PHP version 4.3.10. The reason I was using $HTTP_SESSION_VARS is out of ignorance. I was using the syntax that Dreamweaver produces. Then again, my version of Dreamweaver is a tad bit outdated. I am developing a web site for classified ads. More specifically, right now I am writing a scrip...
by csingsaas
Sun Nov 26, 2006 5:18 pm
Forum: PHP - Theory and Design
Topic: Display randomly ordered MySQL query results on mult pages.
Replies: 12
Views: 3599

Jcart - I followed your suggestion and have a couple of additional questions. 1) So this is essentially creating an array for each field correct? If so, won't I need to define the index each time I loop through such as: $count = 0; while($row = mysql_fetch_assoc($RotatingAds)) { $HTTP_SESSION_VARS['...
by csingsaas
Sat Nov 25, 2006 9:32 am
Forum: PHP - Code
Topic: Storing MySQL result set in session variables?
Replies: 8
Views: 1917

The reason I do not fetch the exact record I need for a given page is because I am creating a search page. There are 5 different criteria the user can specify, and the results are returned to them on a search results page. I want to only show 15 results per page, so if there are 500 results I will n...
by csingsaas
Fri Nov 24, 2006 4:29 pm
Forum: PHP - Code
Topic: Storing MySQL result set in session variables?
Replies: 8
Views: 1917

Maybe looking at my code would help. I think part of the problem is the way I am trying to access the various records in searchresults.php. I looks like I am working with an array when really I'm just trying to get that record number. code for searchengine.php ---------------------------------------...
by csingsaas
Fri Nov 24, 2006 4:04 pm
Forum: PHP - Code
Topic: Storing MySQL result set in session variables?
Replies: 8
Views: 1917

Storing MySQL result set in session variables?

Is it possible to store the results returned my a MySQL query in a session variable?

I have a script that acts as a search engine. I want to take the results of the search and display then on a different page.


Thank you in advance.
by csingsaas
Fri Nov 24, 2006 4:00 pm
Forum: PHP - Theory and Design
Topic: Display randomly ordered MySQL query results on mult pages.
Replies: 12
Views: 3599

After taking your advise I began throwing together some code to accomplish my objective using session variables. I have run into one sticking point: how do I store a mysql result set in a session variable?

I have spent around an hour searching online for articles on this topic without any success.
by csingsaas
Fri Nov 24, 2006 12:11 pm
Forum: PHP - Theory and Design
Topic: Display randomly ordered MySQL query results on mult pages.
Replies: 12
Views: 3599

Correct me if I'm wrong. If I use session variables won't the overall performance of my site suffer greatly if I have a lot of concurrent visits?
by csingsaas
Fri Nov 24, 2006 12:00 pm
Forum: PHP - Theory and Design
Topic: Display randomly ordered MySQL query results on mult pages.
Replies: 12
Views: 3599

Display randomly ordered MySQL query results on mult pages.

I have created a MySQL query that randomly orders the results ( ORDER BY RAND() ). I am displaying the results on multiple pages, with 15 records per page. I have no problems implementing multiple pages so that no duplicate records are shown if I order the results by some criteria. However, if I thr...