Note that there are some explanatory texts on larger screens.

plurals
  1. POphp+mysql - Like does not display all values
    primarykey
    data
    text
    <p>Im making this person search function build up of jquery(json) and php, the from the search bar are sent to the php document but it doesn't behave like i want it to.</p> <p>I don't know if there's problem with the mysql server or the php code, but when i execute my search script it does not return values on (example):"e","s" or "r" but if i type in the whole name of a person, or just an "a" it returns all names with an "a" in it.</p> <p>here is a little snip of my script:</p> <pre><code> $string = trim(mysql_real_escape_string($_POST['string'])); $sql = "SELECT * FROM users WHERE firstName LIKE '%$string%' OR lastName LIKE '%$string%' ORDER BY firstName ASC"; foreach($db-&gt;query($sql) as $row) { //usage of $row like: $name = $row['firstName']." ".$row['lastName']; } </code></pre> <p><strong>Update:</strong><br> heres the whole script:</p> <pre><code> $sql = "SELECT * FROM users WHERE firstName like '%$string%' OR lastName like '%$string%' ORDER BY firstName ASC"; foreach($db-&gt;query($sql) as $row) { $name = $row['firstName']. " ".$row['lastName'];//combing firstname with lastname //replacing æ,ø,å,Æ,Ø,Å with html friendly charcodes $remove = array("æ", "ø", "å", "Æ", "Ø", "Å"); $with = array("&amp;aelig;", "&amp;oslash;", "&amp;aring;", "&amp;AElig;", "&amp;Oslash;", "&amp;Aring;"); $fname = str_replace($remove, $with, $name); //composing a answer to the user. $stringUser[] = "&lt;li class='searchResultHit'&gt;&lt;div class='searchResultLeft'&gt;&lt;img src='".$row['picture']."'&gt;&lt;/div&gt;&lt;div class='searchResultCenter'&gt;&lt;span class='searchResultContent'&gt;&lt;a href='user.php?id=".$row['id']."'&gt;".$fname."&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;"; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload