Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2003-09-30, 08:33 PM
Junior Member
 
Join Date: Sep 2003
Posts: 3
wa8in42night
Default

Hi every one!
I have been developing PHP applications from last one year, all the time I have been using Hidden fields and Query strings to pass my variable within the same page or to a different page.
Current Situation:
Right now I have a search page "searchMembers.php" I am making an SQL query based upon the user choice. Depending upon the number of rows returned in the search result I am printing links to the other RESULT PAGES (1 | 2 | 3 | NEXT). To access the SQL query I have made based upon the user choice, I am sending my query with the URL to all other result pages by doing the following php work
PHP Code:
// seralize sql query 
$serial_var = serialize($searchQuery); 
//encode sql query 
$out_var = rawurlencode($serial_var); 
// save encoded query to a variable 
$searchquery = $out_var; 
// then attach this sql query to the URLs to other pages in following way 
// a for loop to print links to number of pages of i.e. 1 | 2 | Next 
for (&#036;i = 0; $i < $pages; $i++) 

     &
#036;url = "$ME?screen=" . $i ; 
      // here I am attaching my encoded query to Query String 
     
&#036;myhtml .="<FONT =\"#000000\"> | <a    href=\"$url&amp;searchfor=$searchfor&amp;searchquery=$searchquery\">". ($i+1)."</a> |</FONT>\n"; 

MY PROBLEM:
so for I have been able to attach query to the query string but when I can not get my full query when I get the variable saved in the query string, just to clarify the situation I am using decode and unseralize method when I am retreing my variable in the following way
PHP Code:
&#036;myQuery = unserialize(rawurldecode($_GET["searchquery"])); 
&#036;qid = new PGM_Sql(); 
&#036;qid->query($myQuery); 
&#036;resultNumOfRows = $qid->num_rows(); 
SO ANY ONE PLEASE SUGGEST ME THE BEST WAY TO PASS THIS QUERY TO THE SAME PAGE, I AM SURE THIS ONE WOULD BE SIMPLE FOR MANY OF YOU BUT I CANT FIND THE WAY OUT OF IT.
Reply With Quote
  #2 (permalink)  
Old 2003-10-01, 09:18 AM
stuart's Avatar
Administrator
 
Join Date: Jan 2003
Location: Scotland
Posts: 472
stuart will become famous soon enoughstuart will become famous soon enough
Send a message via MSN to stuart
Default

Im sure there must be a better way to do this....

Do you really need to pass the FULL query? cant you just pass the page number or row count? then use this to dynamically re-build the query.

If you could give more details of how this search hangs together I may be able to suggest a better way to do this.

Stuart
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:10 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.