Hi, Please check the query and also please print the query coming from online. Execute the came query in your database. This will solve the problem easily. With Regards, Madan Mohan Satna (Senior Software Engineer) No:106,1st Main, G.K.V.K Nagar, G.K.V.K Post, Bangalore-65 www.madanmohansatna.com (Mob):+91-9449108891 --- On Tue, 6/17/08, Muhammad Rashid Babsail <el_marsheil@xxxxxxxxx> wrote: From: Muhammad Rashid Babsail <el_marsheil@xxxxxxxxx> Subject: Re: query not returnung rows To: php-objects@xxxxxxxxxxxxxxx Date: Tuesday, June 17, 2008, 2:48 AM are you sure that there is a row that match your search text?? and if there is an error message pls send here so we can help you... --- On Tue, 6/17/08, malayappa2000 <malayappa@nannacomp uters.com> wrote: From: malayappa2000 <malayappa@nannacomp uters.com> Subject: query not returnung rows To: php-objects@ yahoogroups. com Date: Tuesday, June 17, 2008, 4:40 PM Hi Guys fallowing is code for search form. Here what the problem is the query SELECT * FROM bulk_register WHERE ".$field." LIKE'%".$find. "%'"; not returning any Result. plz tell me whre the error is. <?php if(isset($_POST[ 'search'] )) { echo $_POST['field' ]; $find=$_POST[ 'find']; $field=$_POST[ 'field']; //This is only displayed if they have submitted the form if (isset($_POST[ 'searching' ])) { echo "<h2>Results< /h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect( "localhost" , "root", "") or die(mysql_error( )); mysql_select_ db("bulksms" ) or die(mysql_error( )); // We preform a bit of filtering //$find = strtoupper($ find); //$find = strip_tags($ find); $find = trim ($find); echo "find is".$find."< br>"; //Now we search for our search term, in the field the user specified $query="SELECT * FROM bulk_register WHERE ".$field." LIKE'%".$find. "%'"; echo "query is".$query; $data = mysql_query( $query); //And we display the results while($result = mysql_fetch_ array( $data )) { echo $result['firstname' ]; echo " "; echo $result['lastname' ]; echo "<br>"; echo $result['mobile' ]; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches= mysql_num_ rows($data) ; if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br> "; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } } ?> <h2>Search</ h2> <form name="search" method="post" action="searchform. php"> Seach for: <input type="text" name="find" /> in <Select NAME="field" > <Option VALUE="firstname" >First Name</option> <Option VALUE="lastname" >Last Name</option> <Option VALUE="mobile" >Mobile</ option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]