Best search technique for mysql using php

I have around 7 text boxes of which 3 are mandatory , I have one search table, I want to know what is the best logic to achieve the optimum search results.

-------------Problems Reply------------

i recommend using full text search, it will search all the fields and ignore them if null, here is a decent guide on it and i would add filters that make it more than 2 characters and ignore an array of common words e.g put your search in a if statement like this

$ignorewords = array("the","and","their","there" ,"to","fix","make","add","then","if", "for", "then","or");

if ( (in_array(strtolower($value), $ignorewords) == false) && (strlen($value) > 2 ) )

use like "%{$value}%" to get things containing words or parts of words. the if statement checks if the search term ($value) is in the array, and if its not it will return false, the >2 restriction is to prevent someone typing "a" and getting everything with the letter a in back.

Category:php Views:1 Time:2017-09-13
Tags: php mysql

Related post

  • Simple encryption technique for MySQL using PHP 2010-01-24

    How do I encrypt a user password in PHP? Please explain in a way a beginner can understand. I already have this sample code: $password = "john856"; $encrypt_password = md5($password); echo $encrypt_password; How do I incorporate it in my current code

  • Which is the best searching technique for file search in android mobile? 2013-04-29

    Can any body tell me which is the best searching technique for searching files on android mobile.? I hv used sequential searching technique. Is there any algorithm which is more efficient than sequential/linear. If any pleas tell me how is it efficie

  • Nested or Joins query for MySQL using PHP 2011-05-15

    I have many a times tried using nested query for MySQL in PHP, but it does not work. Is it not possible to do nested/Joins queries? Just a Scenario: I have two tables one table with user id and the other with data. User logins and with sessions I hav

  • How do I capture search index in MySQL using PHP? 2011-02-01

    I do have table table1 with two columns say name and details when I search by details there were multiple name listing. I want to retrieve that name list and display to a webpage using PHP. how can I do that?? --------------Solutions------------- the

  • Best Searching Technique for large number of possibilities 2012-11-22

    I'm trying to search text file for large number of possibilites. for example, I want to search a text file that contains unique names. now, if I found name X then I want to store X in another file. the problem here I have over 1000 unique names, and

  • Should I use prepared statements for MySQL in PHP PERFORMANCE-WISE? 2010-02-06

    I understand the security benefits of prepared statements in MySQL. No need to cover that topic here. I'm wondering about the performance aspect of them. Now, I know when a query using a prepared statement is executed twice in a single PHP script, it

  • What are the best practices to encrypt passwords stored in MySql using PhP? 2010-12-20

    I am seeking advice on how to securely store passwords in MySQL using PHP. Overlooking the limitations of PHP itself, I want to know more about salting, hashing, and encrypting these bad boys. Obviously people will continue to use weak passwords unle

  • Active Page for CSS using PHP and MYSQL 2012-02-21

    I am trying to build a menu with an active page element for CSS using PHP and MySQL. This example PHP/HTML hybrid works, and is what I'm trying to mimic. <nav><ul> <li<?php if ($thisPage == "1") echo " class=\"active\""; ?>>

  • Performing searches against large dictionaries using php 2011-07-25

    Currently I am trying to perform text searches against large dictionaries using php or mysql. Until now I haven't found the best way to do that. For example there is a Text:Scan module written in Perl

  • Insert unknown number of rows into MySQL using PHP 2010-12-19

    I am trying to insert an unknown number of rows into MySQL using PHP. This is how it should work: Javascript parses HTML DOM to create a multi-dimensional array based on a css class. The array will have a certain number of rows(or sub-arrays) corresp

  • Effective way to store user selections in MySQL using PHP? 2011-01-14

    I'm having trouble figuring out the best way to store what information my users want to see. I apologize for not being able to find an easy way to explain my problem, but here goes (the fruits are for example's sake): Let's say my users have an optio

  • Problems in inserting data using "safe way to input data to mysql using PHP" 2011-01-17

    I am trying to input data using forms into the MySQL, and also using mysql_real_escape_string for this purpose. Unfortunately I am having a problem with the output. It displays \s, or if I use stripslashes then it removes all slashes. If I submit web

  • Search techniques for a bot in a field 2011-04-19

    My field consists of open grid spaces and filled grid spaces. My bot can move on only open spaces. It can only detect if there is a filled grid space in any of its 8 neighbouring grids (i.e. up, down, left, right , and diagnol spaces). That is, it ca

  • List records in mysql using php 2010-01-18

    This is the last thing I'm gonna do, after I can make this work, I can produce to designing which might be a lot easier. Thanks for all your help. I want to list a record from mysql using php by typing a query in the text box. Then the program will l

  • how to add multiple records in mysql using php 2010-01-23

    how to add multiple records in mysql using php. Is using array the only solution to this problem. Because I tried using array but the record that would be added in the database would look like this: array --------------Solutions------------- You can

  • Is there a way to delete the most recent entry in MySQL using PHP? 2010-03-26

    I want to delete the most recent entry in MySQL using PHP, is there a function that allows me to do that? $query2 = "DELETE FROM test WHERE ___"; --------------Solutions------------- Assuming you have an AUTO_INCREMENT field on your table, you can do

  • Upload XML feed to mysql using PHP 2010-08-11

    I have an XML feed coming in: <?xml version="1.0" encoding="UTF-8"?><product> <name>John</name> <contact_email>[email protected]</contact_email> <contact_telephone>01234 567</contact_telephone> <url

  • How do you select records with a certain time range from MySQL using PHP? 2011-04-03

    How to choose from MySQL, using PHP, records that were created for a certain period of time, if each record has creation time in timestamp? --------------Solutions------------- First you need to connection to the database, then run the query against

  • How to display the values into Android Client from MySQL using PHP Web Service 2011-10-03

    I have question regarding on how to display the values into the Android Client from online database in MySQL using the PHP Web Service. The idea is such that initially when the activity is displayed, the first record must be displayed in the textview

  • CSV into MySQL using PHP 2012-02-03

    I'm trying to import data from my students.csv file into mysql using php. The entries in the csv file is in such a way that column (student_number, fname, lname, level) will be inserted into biodata table.. I'm also uploading the student.csv file fro

  • Advanced search engine for MySQL that doesn't require unique INT and covers multiple tables 2012-03-23

    Recently I developed a piece of software that downloads logfiles from our online production environment to an internal NAS device with a MySQL database to enable us to store more information (online space is expensive). This thing has been up and run

  • .mov file to .flv file conversion issue for ffmpeg using PHP 2009-12-17

    Is there any possible way to convert .mov file to .flv file conversion issue for ffmpeg using PHP. If yes, kindly let me know how to do? Thanks in advance, Fero --------------Solutions------------- I think a simple google query would of been useful;

  • How to put the corrent datetime in MySQL using php 2010-11-05

    How to put the corrent datetime in MySQL using php. result should be : mysql_query("INSERT INTO users (r_date) VALUES ('the corrent datetime')"); the type of (r_date is datetime --------------Solutions------------- If your field is a DATE or DATETIME

  • how to insert ampersand in mysql using php? 2011-03-01

    How to insert ampersand in mysql using php? Thanks in advance When I execute the following code the “one” is saves in database but the “ second” and ampersand sign won’t. plz help me… $companyName ="one & second"; INSERT INTO registeration(compan

Copyright (C), All Rights Reserved.

processed in 0.153 (s). 11 q(s)