Jump to content

Search Form


Pandareen

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.