Posted by Anne Bos on 08/27/06 20:11
I have a database where authors are listed together with articles they
wrote in a little journal. I want to present people what author has
produced what articles. In order to do that I made a form, adressing a
file called authors.php. If someone gives in a name of an author,
his/her name as well as his/her articles are listed as expected. So
far no problems.
However, if no name is given or if just return is hit, the querry
gives all authors. In that case I want no author being given back,
instead I prefer to give a sentence: "Please give the name of a
possible author".
The relevant items are (within php of course):
$search = $_POST[author];
and
$sql="SELECT (the relevant field names) FROM journal WHERE author LIKE
'%$search%' ORDER BY idart";
(idart gives a chronological numbering of all articles)
What should I do? Any hint is appreciated.
Anne Bos
[Back to original message]
|