|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26055 problem withs strings
Submitted: 2003-10-31 07:51 UTC Modified: 2003-10-31 08:00 UTC
From: kiran_jack at rediffmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.1 OS: apache
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
45 + 19 = ?
Subscribe to this entry?

 [2003-10-31 07:51 UTC] kiran_jack at rediffmail dot com
I have a problem with a query. I'd like to make a search in a  table inserting 2 or more words in the input form, using the OR.  Everything works fine with 1 word but with more I obtain result only for  the LAST inserted one
Please reply me soon,

Reproduce code:
require 'db_connect1.php';
if ($search) // perform search only if a string was entered. 

$words = explode (" ", $search); 
$num = COUNT ($words); 
WHILE ($n<$num) { 
$queryWhereArray = "(description like %".$words[$n]."%  || keywords like %".$words[$n]."%    || cost  like  %".$words[$n]."%  )"; 
$queryWhere = join(" or ",$queryWhereArray); 
$query = "select count(id) as k, *
from search 
where $queryWhere group by k 
order by id desc";


 $result = mysql_query($query);   
 $num_rows = mysql_num_rows($result);

       if (!($num_rows))		
             echo "Sorry - no matches were found. Please <a href=\"search1.html\">go back</a> and try some different search terms.";

       else {
            echo "<font face=verdana,sans-serif size=-1>";
		echo "Search Results:"; 
		while ($r = mysql_fetch_array($result))
		 { // Begin while 
		echo "<br>";
            $link1= $r["link"];
		$meta= $r["description"]; 
     		$keywords1= $r["keywords"];

            echo "<table border=0 cellpadding=0 cellspacing=0>";
            echo "<tr>";
            echo "<td width=50>";
            echo "$id1";
            echo "</td>";
            echo "<td width=500>";        
            echo "<a href='$link1'>";
		echo "$meta";
            echo "</a>";
            echo "<br>";
            echo "$keywords1";
            echo "</td>";
            echo "<td>";
            echo "Rs";
	    echo "$price";
            echo "/-";
            echo "</td>";
            echo "</tr>";

            echo "<br>";
            echo "<br>";

		 } // end while 
		echo "</table>";
            echo "</font>";
 echo "You did not enter anything to search for. Please <a href=\"search1.html\">go back</a> and enter a search word.";

Expected result:
i want to search the entire string


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-31 08:00 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This is not support forum. 

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 22:01:31 2024 UTC