| | |
Searching Multiple tables... Please help me!!!!!
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I am new in PHP. I have a form having fields from 3 different tables.. I want to search these 3 tables simultaniously for reporting the information...
1st table personal details.
2nd table services offered.
3rd table payment details.
I want to search each and every fields in these tables simultanioulsy...
Please help me...
1st table personal details.
2nd table services offered.
3rd table payment details.
I want to search each and every fields in these tables simultanioulsy...
Please help me...
You can use the join function in mysql.Could you show us what fields are you trying to get in those tables?
You can search multiple tables this way.
There are 2 input fields. Whatever the user enters in 1st input field will search table1 and it searches table2 for 2nd input field.
If this is not what you want, then you have to post your code.
Cheers,
Naveen
php Syntax (Toggle Plain Text)
<?php $conn=mysql_connect("localhost","root"); mysql_select_db("test"); if(isset($_POST['submit'])){ $value1=$_REQUEST['value1']; $value2=$_REQUEST['value2']; $query1="select * from table1 where column1 like '%$value1%'"; $result1=mysql_query($query1); while($row1=mysql_fetch_array($result1)){ // fetch the data for query 1 } $query2="select * from table2 where column1 like '%$value2%'"; $result2=mysql_query($query2); while($row2=mysql_fetch_array($result2)){ // fetch the data for query 2 } } ?> <html> <body> <form method="post" action="test.php"> <input type="text" name="value1"><br /> <input type="text" name="value2"><br /> <input type="submit" name="submit" value="submit"> </form> </body> </html>
There are 2 input fields. Whatever the user enters in 1st input field will search table1 and it searches table2 for 2nd input field.
If this is not what you want, then you have to post your code.
Cheers,
Naveen
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
Here's how'like it goes:
something like that.
php Syntax (Toggle Plain Text)
$query="Select * from table1 LEFT JOIN table2 USING(id) LEFT JOIN table3 USING(id) WHERE id='1'";
something like that.
![]() |
Similar Threads
- Searching multiple MS SQL Tables (VB.NET)
- Searching for a record in multiple tables (VB.NET)
Other Threads in the PHP Forum
- Previous Thread: Question about crypt function
- Next Thread: PHP & Forms & Textarea
| Thread Tools | Search this Thread |
5.2.10 action apache api array beginner beneath binary broken cakephp checkbox class classes cms code cron curl database date destroy display dynamic echo echo$_get[x]changingitintovariable... email encode error fcc file files folder form forms function functions google header howtowriteathesis href htaccess html image images include insert ip javascript joomla limit link local login mail memberships menu mlm mod_rewrite multiple multipletables mysql mysqlquery neutrality oop open passwords paypal pdf php provider query radio random record remote rss script search server sessions sockets source space sql strip_tags syntax system table template thesishelp tutorial update upload url validator variable video voteup web window.onbeforeunload=closeme; youtube






