# Search in a table help

**URL:** <https://forum.kirupa.com/t/search-in-a-table-help/234994>\
**Category:** Uncategorized\
**Created:** [August 7, 2007, 6:00pm UTC](https://forum.kirupa.com/t/search-in-a-table-help/234994 "2007-08-07T18:00:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wo1olf](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wo1olf](https://forum.kirupa.com/u/wo1olf)\
**Post date:** [August 7, 2007, 6:00pm UTC](https://forum.kirupa.com/t/search-in-a-table-help/234994/1 "2007-08-07T18:00:47Z")

</div>

I have a search form where every text field correspond to a column name in a database table. I want to find all the items in the table that may have any value = to one typed by the user in the search form. I have tried with syntax above

```php
mysql_query(''SELECT* FROM table name WHERE fieldname LIKE formValue
AND nfieldname LIKE nformValue...; )'');
mysql_query('' 'SELECT* FROM table name WHERE fieldname LIKE formValue 
OR nfieldname LIKE nformValue...; )'')

```

sometime it works, and sometimes i get undesired results (that’s are not conserned).  
I want also to eliminate a a value that was left empty by the user.

```php
'mysql_query(''SELECT* FROM table name WHERE fieldname LIKE formValue
AND nfieldname LIKE ' ''.(array_key_exist($_POST,'nformValue')).'' ';'');

```

but it do not work. can any body help me with that?
