Jump to content

how to search the whole db?


jac.kock

Recommended Posts

hi all,

 

is there a sql query that looks in every table for a given string? now i just do:

 

$sql="select * from [the table] where name_desc like "'$string'" and del_tab='0'";

 

this search only that given tabel but is ther a query thats search trough the whole bd?

 

thnx all for youre help :)

 

jamie ( holland)

Link to comment
Share on other sites

hi,

 

its about 14 tables where i want to check if they are deletted bij there del_tab='1' to show in de cms so that i casn reset them if needed:)

 

and the smallesd table has about 2300 items :) so thats why i want to search the whole bd butt if there is no code for it i must make one that search all bij there table names :(

 

thnx

 

jamie ( holland )

Link to comment
Share on other sites

In order to do what you want, you would have to first get a list of all of the tables in your database and then with that list, build a bunch of queries and run those off separately.  That said, this is an absolutely horrible idea.  This is going to be slow and completely defies the purpose of storing things in tables.  If you need to search on something, then there should be a metadata table or something which all of these link to.

 

~awjudd

Link to comment
Share on other sites

I'm not sure exactly how you set up your tables and what the correlation is between them but there must be a much smarter way to do what you want to do.

Instead of marking every table with del=1 you might be able to mark ONE of the table rows for deletion and join the other tables you need deleted.

Link to comment
Share on other sites

What your asking insinuates your using a flat file database instead of a relational database as you have the same data in different tables. This completely defies the rules of normalisation and goes against everything a relational database stands for.

 

I would suggest you review your database structure before continuing as its the key in making your application work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.