0

Hi...
I am using following query to get data from a table

select * from emp where ename regexp 'rajkiran'

It will return only the rows with ename=rajkiran

but I want to select all the rows with ename =raj kiran & ename=rajkiran using a single query

2
Contributors
7
Replies
9
Views
5 Years
Discussion Span
Last Post by pritaeas
0

I have a search engine to search records from mysqldb.

The script used as follows.

$text=$_REQUEST['txt'];
    $q="select * from table where field regexp '$text' ";

I want to get all records from database with and without space character.

For example If $text="KG 1957" or $text="KG1957"
I want all the records containing KG 1957 & KG1957

0

If you are using a fixed format like that: create a new variable from the first two characters. Then add the space and the question mark. Then add the remaining characters. Then use the new variable in your query.

You have to code that business logic, or allow input of a regex in the editbox.

Edited by pritaeas

0

Search text is not in fixed format.
It varies.
How to change the query to select the data with all possible formats..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.