Pandareen Posted January 5, 2012 Share Posted January 5, 2012 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? :-? Quote Link to comment https://forums.phpfreaks.com/topic/254438-search-form/ Share on other sites More sharing options...
ManiacDan Posted January 5, 2012 Share Posted January 5, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/254438-search-form/#findComment-1304640 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.