1

I am Trying to make search function on my website i use GET

So i want if user search "How To develop php script in a few seconds With mysql"

It shouldn't mind how long or short or Ascending or descending the search is like if the post title that exists it table is "developing php With mysql" So far 'develop, PHP, and, mysql' exist in any title i want it To list all post having such title

So i use

mysql_query("SELECT * FROM blog,forum WHERE (titleLIKE '%".$_GET['search']."%')");

The result only bring the one that match how it is writing or only if the word before Space match like "develop" or "php"

I will like To do it like google own which doesn't mind your spelling or how it is written To make display of look alike search

I tried but don't work

Norman M
  • 243
  • 1
  • 9
  • 2
    Please read up on **SQL Injection**. This code highly vulnerable! – ppeterka Aug 26 '16 at 13:26
  • 4
    Every time you use [the `mysql_`](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) database extension **a Kitten is strangled somewhere in the world** it is deprecated and has been for years and is gone for ever in PHP7. If you are just learning PHP, spend your energies learning the `PDO` or `mysqli` database extensions. [Start here](http://php.net/manual/en/book.pdo.php) – RiggsFolly Aug 26 '16 at 13:27
  • While those comments are valuable, I think the code demonstrates the intention very well. No reason to overcomplicate things here. – Eiko Aug 26 '16 at 13:33
  • I am an upcoming developer So that is why I use mysql_query – Adeleye Benjamin Adesanoye Aug 26 '16 at 13:37
  • This Code do not search like i want – Adeleye Benjamin Adesanoye Aug 26 '16 at 13:55
  • @AdesanoyeAdeleyeBenjamin look into natural language searches – ʰᵈˑ Aug 26 '16 at 14:24

0 Answers0