hi
i want to know that how can i search the entire database at once....
i have code with which i can only search from a single table but i want that search should be performed on
entire database....
i m using php+mysql.......
help me out...

Use follwoing query

SELECT * FROM * WHERE * LIKE '%your_search_string%'

i just need to use stars only?no need to give the table name....it'll automatically fetch records from all tables??????

yes.it will check all the columns of all the tables of any database

SELECT * FROM * WHERE * LIKE '%your_search_string%'

first * is for all the fields
second for all the tables
third for all the columns of the tables on which you want to apply search criteria. In other words, it will give you results from all the database. Try it.

Cheers

i hve used your query......but m still getting one error.m sending you the code ........
-----------search.php------------------

<HTML>
<HEAD>
 <TITLE>New Document</TITLE>
</HEAD>
<BODY>
  <form type="GET" action="result.php">
<input type="text" name="key">
<input type="submit" value="Search">
</form>
</BODY>
</HTML>

------------------------result.php------------------------------

<?php
 $db_server = "localhost";
     $db_name = "master";
     $db_username = "root";
     $db_password = "root";
     function db_connect(){

    global $db_server;
    global $db_name;
    global $db_username;
    global $db_password;

    $con =@ mysql_connect($db_server,$db_username,$db_password);
    if ($con!=false){
        if (!(mysql_select_db($db_name,$con))){
            // cannot find database
            die("Cannot find Database");
        } else {
            // fine
        }
    } else {
        die ("Cannot connect to database");
    }
return $con;
}
function db_search($key) {
        $con = db_connect();
    $key = mysql_escape_string($key);
    $sql = "SELECT * FROM * WHERE * LIKE '%".$key."%'";
        $result = mysql_query($sql,$con);
        mysql_close($con);
    return $result;
}
if(isset($_REQUEST['key']))
{
   $key = $_REQUEST['key'];
   $result = db_search_bible($key);
  if($result == FALSE)
    $content = 'No Match Found';

else
    while ($row = mysql_fetch_row($result)) {
            $content .=  $row[0].', '.$row[1].', '.$row[2].’,  '.$row[3].'…<br>';
}

echo $content;
?>

error i am facing is.......................
Parse error: parse error in c:\apache\htdocs\newhr\result.php on line 43

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.