divadiva Posted April 30, 2009 Share Posted April 30, 2009 Experts, This time I have figured out the problem but stuck with the solution. I have this search page,when I enter Adjacent Technology in the search criteria.It gives me the right result.But when I click next to go to next page it trims Technology and the search criteria searches for only Adjacent(which doesnt exist). Here is the code: $MaxDisp = 50; //Set Maximum number of rows to be displayed //Fill in data table for ($RowsDisp =1; ($QueryResultRow= mysql_fetch_array($QueryResult)) AND $RowsDisp <= $MaxDisp; $RowsDisp++){ //print_r(mysql_fetch_array($QueryResult)); ?> <TR align="center" valign="top"> <TD align="middle" valign="center"> <? </TR> <? } ?></TABLE> <? if(!$skip) $skip=0; //set the value of skip to 0 if unset print("Total number".$QueryTotalRows); print "IF Passed ".($skip+$MaxDisp); if(($skip+$MaxDisp)< $QueryTotalRows){//if end is earlier then next skip value, set the end to # of rows print("Query Total Rows".$QueryTotalRows); $PageEnd = $skip+$MaxDisp; print "page end is".$PageEnd; } else { print "After else the total number of rows are". $QueryTotalRows; $PageEnd = $skip+$MaxDisp; print "Page end after else".$PageEnd; $PageEnd = $QueryTotalRows; } print "<p>Displaying records $skip - $PageEnd of $QueryTotalRows<p>"; //SKIP =0 and MAX DISP at this point is 50 if ($skip-$MaxDisp >=0){ //Go back a page print"Goback a page". $skip-$MaxDisp; print "<A HREF=EquipmentSearch.php?skip=".($skip-$MaxDisp)."&manufacturer=$manufacturer&process=$process&wafer=$wafer&search=$search>Prev </a>"; print "      "; } print "BEFORE if(forward)".$QueryTotalRows; print"skip+maxdisp".($skip+$MaxDisp); if ($skip+$MaxDisp <= $QueryTotalRows) { //Go forward a page print "<A HREF=EquipmentSearch.php?skip=".($skip+$MaxDisp)."&manufacturer=$manufacturer&process=$process&wafer=$wafer&search=$search>Next</a>"; } ?> Thanks in advance. Best, Divya Link to comment https://forums.phpfreaks.com/topic/156262-populating-data/ Share on other sites More sharing options...
the182guy Posted April 30, 2009 Share Posted April 30, 2009 It looks like you need to use urlencode() to encode special characters in your search critirea, such as a space. That could be why everything after the space is being trimmed off. Try this: print "<A HREF=EquipmentSearch.php?skip=".($skip+$MaxDisp)."&manufacturer=$manufacturer&process=$process&wafer=$wafer&search=" . urlencode($search) . ">Next</a>"; Link to comment https://forums.phpfreaks.com/topic/156262-populating-data/#findComment-822643 Share on other sites More sharing options...
divadiva Posted April 30, 2009 Author Share Posted April 30, 2009 Thanks, it worked like a charm. I did urlencode before Manufacturer .It is working fine now. Link to comment https://forums.phpfreaks.com/topic/156262-populating-data/#findComment-822783 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.