[SOLVED] Wilcards in Variables?

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
Hebbs
Forum Commoner
Posts: 43
Joined: Mon Apr 22, 2002 9:34 pm
Location: Perth, Western Australia

Wilcards in Variables?

Post by Hebbs »

Am having difficulty with including a wildcard within a variable.

To cut a long story short I am have an application where I want users to be able to configure their own wildcard searches e.g. '%findthis' etc.

When the search criteria containing the wildcard is carried forward (as a variable) and submitted in a query I continuously get an error message stating 'Warning: printf(): Too few arguments in ....' where ... defines the code line.

I can code the wildcard into the Select statement but I would rather the users construct their own.

Any thoughts?

Hebbs
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

% in the format string of the printf variants are control characters. you need to either switch which functions you use to print, or escape the % with %%...
Hebbs
Forum Commoner
Posts: 43
Joined: Mon Apr 22, 2002 9:34 pm
Location: Perth, Western Australia

[Solved] Wilcards in Variables?

Post by Hebbs »

Doh!

Thanks for the solution, amazing how sometimes you just cant see things!

Appreciate that!

Hebbs
Post Reply