passing special arguments in a URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spatter9999
Forum Newbie
Posts: 2
Joined: Fri Jul 04, 2003 3:22 pm

passing special arguments in a URL

Post 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.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

well first off why not have sql do the ordering?

just tage "order by <feild>" to the end of those search queries
spatter9999
Forum Newbie
Posts: 2
Joined: Fri Jul 04, 2003 3:22 pm

Post 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.
Post Reply