Make Reports

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
User avatar
maskme
Forum Newbie
Posts: 6
Joined: Sun Jul 28, 2002 9:27 am

Make Reports

Post by maskme »

Suppose I've Fields

Title
Age
Gender
Country

What I want is that a user selects either of these fields or all of these fields to get a report based on the selection.

For e.g.: A user selects age group from 18-21 & selects country USA, so from the database it will select those records only n give.

Firstly how should i know which of the above fields is selected.

e.g.

-------------------The below is for just one selection-----------------

Code: Select all

if ($title != "") $var = "TITLE = $title"

$squery = "SELECT TITLE, AGE, GENDER, COUNTRY FROM tblparent where $var";
$sresult = mysql_query($squery) or die("Search Query Failed");
-----------------------------------------------------------------------

And if two or more of the fields are selected how should i put AND between them in the Query

Please help!

Yusuf
Post Reply