srinivas6203 Posted April 21, 2008 Share Posted April 21, 2008 Hi all I want display all the records from database by entering data into multiple text fields. I am using 5 input fields like username,source,destination,fromdate,todate. First i want to search username and source. For that i entered username as "peter" and source as "1234". For that the code as follows if(($_POST['username'])) && ($_POST['source'])) { $sql_query=mysql_query("select * from example where username='".$_POST['username']."' and source='".$_POST['source']."'"); while($row_query=mysql_query($sql_query)) { //print records } Now i want to search username,source,destination. For that i entered username as "peter" and source as "1234". For that the code as follows if(($_POST['username'])) && ($_POST['source']) && ($_POST['destination'])) { $sql_query=mysql_query("select * from example where username='".$_POST['username']."' and source='".$_POST['source']."' and destination='".$_POST['destination']."'"); while($row_query=mysql_query($sql_query)) { //print records } Next source,username,from date next todate,username,fromdate and some other fields the code was going so long. each time i am compare and write query for this. This was taken so much time. How can i search by using multiple input fields by easiest way. I am using php and mysql thanks in advance Quote Link to comment 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.