mysql search - entire database

is there a way to search an entire mysql database for text if i don't know the table it's in?

say i wanted to search for "test" in my entire database, how would I do this?  is this possible?
LVL 1
bschwartingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

psimationCommented:
You will need to use mysql_list_tables() to get all the tables in your DB, then, inside another loop, you will have to use mysql_list_fileds() to find the fields in each table, and then only can you construct your SQL string in loops that will compare the text with each fieldname in each table.
0
bschwartingAuthor Commented:
can you give an example?
0
psimationCommented:
Hmm, I assumed you knew I was giving you a "pseudo php" method, but I see now that you posted in the MySQL DB section and linked to PHP as well.

I don;t think there is a solution in mysql only. You will need to write a script a language like PHP where you make use of some of it's built-in mysql functions to first get an array of tablenames, and then for fieldnames in each table. From that you would then use PHP to construct a SQL string that runs through all the possibilities. It's not going to be easy - I suggest you look at the php manual at php.net, and in particular, the mysql functions - there are some examples there already that you could use as the base of your script.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bschwartingAuthor Commented:
ok, thanks
0
black0psCommented:
bschwarting, did you accomplish this task and if you did, could you post your code?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.