Jump to content

Recommended Posts

if your saying that you want to find a certain record in 10 table then i guess the only way is to query each table one by one

What php and mysql syntax would I use to accomplish this?

 

it will only need the usual way the fetch array and mysql_query

this is my code so far:

 

$query = "SELECT `contact_n_questions`.`fname`, `dispo_callBack`.`fname`, `dispo_client`.`fname`
FROM contact_n_questions, dispo_callBack, dispo_client
WHERE ((`contact_n_questions`.`fname`) OR (`dispo_callBack`.`fname`) OR (`dispo_client`.`fname`)) = '$search_fname'";
			$result = mysql_query($query) or die(mysql_error());

your using a Cartesian join i dont know if thats gonna sort it out but look if you can do a print_r(mysql_fetch_array(' ')) i believe its the same as the usual thing foreach or while

 

but with this question

How would run a loop with the tables in the db? 

 

i believe you you have to come up with

$table = array('table1','table2');

foreach($table as $tbl)
{
    select * from $tbl 
}
[code]

although querying for this way may be slower but it will give you an exact ouptu you neeed

[/code]

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.