Jump to content

Recommended Posts

Hello!To search in a table from my database i use this:

 

mysql_connect ("localhost", "","")  or die (mysql_error());
mysql_select_db ("");

$key = $_POST['key'];

$sql = mysql_query("select * from internet_securitate where nume_produs like '%$key%'");

while ($row = mysql_fetch_array($sql)){
    echo 'Produs ID: '.$row['internet_securitateID'];
    echo '<br/> Denumire Produs: '.$row['nume_produs'];
    echo '<br/> Descriere: '.$row['descriere'];
    echo '<br/> Disponibilitate: '.$row['disponibilitate_produs'];
    echo '<br/><br/>';
    }

 

can i expand this to searh in 3 tables? :-?

 

Link to comment
https://forums.phpfreaks.com/topic/254438-search-form/
Share on other sites

You should probably not post your datbase username and password in public, especially if your password is what you originally posted (you should change it.  Now.)

 

To actually address your question:  yes, many ways.  If there are equal numbers of columns in these tables, you can use UNION to join three queries together.  If there aren't, you can simply perform three queries.

Link to comment
https://forums.phpfreaks.com/topic/254438-search-form/#findComment-1304640
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.