What's wrong with this or something similar:
$sql = mysql_query("
SELECT
*
FROM
project
WHERE
project_name
= '$pro_name'
AND ( final_approved = 'yes' AND '$project' = 'Management Approve'
OR first_approved = 'yes' AND '$project' = 'Pre-Approved'
OR ....ect...
";
$result = mysql_query($sql);
$record_count = mysql_num_rows($result);
HTH
Good luck Dan..
=======================
Natividad Castro wrote:
> Hi to all,
> I have a search form where users can search project by 'Project Name' after
> they type in the project name, they will select which project they will like
> to view from a drop down menu which contains: Management Approve,
> Pre-Approved, Management-Not-Approved, and Pre-Not-Approved pproved.
>
> I'm using switch statement
>
> switch ($project)
> {
> case "Management Approve"
> $sql = mysql_query("select * from project where project_name='$pro_name'
> and final_approved='yes'");
> $result = mysql_query($sql);
> $record_count = mysql_num_rows($result);
>
> case "Pre-Approved":
>
> $sql2 = mysql_query("select * from project where project_name='$pro_name'
> and first_approved='yes'");
> $result2 = mysql_query($sql2);
> $record_count2 = mysql_num_rows($result2);
>
> and so on...
>
> My question is: how do I call $sql, or $sql2, and $result, or $result2 to
> loop and put the fields into an array? The reason I'm asking is because the
> users will be able to navegate through the recordset, so I need to call just
> the query that match the criteria either '$result' or '$result2' to be able
> to display the right information.
>
> e.g.,
> while($query_data = mysql_fetch_array($result)) //it can be $result2
> {
> $project_id = $query_data[project_id];
> $project_name = $query_data[project_name];
> }
>
> I'm not sure if this explanation make sence to you guys, but if anybody
> would like to take the time and try to help me out, that would be great
>
> Thanks in advanced
> Nato
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php