Page 1 of 1

passing special arguments in a URL

Posted: Fri Jul 04, 2003 3:22 pm
by spatter9999
I'm using a table to sort some data from a mySQL database. When you click the header of the table, it sorts the table by that field. To do this, when a header is clicked it passes 2 value: the current mySQL query that produced the table, and the field it's supposed to sort by.

Example of one of the table headers:
<a href="allreps.php?sort=name&searchstring=<? echo "$searchstring"; ?>">Name</a>

and $searchstring would look something like this:
"WHERE lname LIKE '%doe%' AND mgnum LIKE '%58%'"

But when passed, something is changing the string and interpretting it as:
"WHERE lname LIKE '%doe%' AND mgnum LIKE 'X%'"

The %58 turns into an X... if I was to pass %59, it'd turn it into a Y. How can I get it to pass the string and not try to interpret it?

Any suggestions would be appreciated.

Posted: Fri Jul 04, 2003 4:58 pm
by m3rajk
well first off why not have sql do the ordering?

just tage "order by <feild>" to the end of those search queries

Posted: Fri Jul 04, 2003 5:34 pm
by spatter9999
Okay... so then $searchstring would look like this:

"WHERE lname LIKE '%doe%' AND mgnum LIKE '%58%' ORDER BY lname"

I still need to pass this string without the browser trying to interpret the %58 as a X.