text search

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
rfigley
Forum Commoner
Posts: 70
Joined: Sun Apr 21, 2002 7:10 pm

text search

Post by rfigley »

My queries so far have dealt with looking for an exactt text string in a given column:

Code: Select all

<?php
$query = ("select * from tbl_members where active!='No' and chapter='Chapter Name' AND unit='Lunch' order by 'category'");
?>
How would I change this to use a text box and search the "Chapter" field for a string similar to or starting with the text entered?
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Code: Select all

$query = ("select * from tbl_members where active!='No' AND chapter='".$_POST['chapter']."' AND unit='Lunch' ORDER BY category");
Make sure the previous form has a post method and of course an element named chapter.
rfigley
Forum Commoner
Posts: 70
Joined: Sun Apr 21, 2002 7:10 pm

Post by rfigley »

At the risk of looking like too much of a beginner (Idiot?) can you show an example of an appropriate "Post" method?
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Like:

Code: Select all

Form Action:
<form action="script.php" method="POST" />

Element:
<input type="text" name="category" />
Post Reply