-
k, I have a question. In a combo box, I have the user select a company name and that name is then sent to the query. What I am trying to do is if no selection is made, the query would still run as if all the selections were made, returning all the companies which fall into that category. Do you know how to do this? I created an <option>ALL</option>, but ccant figure out what its value should be? Help?
-
Let's assume that the company name combo's default value is 'all'
if ($C_name=="all"){
$company_name_cond=" and 1=1 ";
}
esle{
$company_name_cond=" and c_name = $C_name ";
}
$sql="select * from company, activity
where c_id = a_c_id and
medivas = $poc and
priority in ($prioritya, $priorityb, $priorityc) and
a_date between $startdate and $enddate ".$company_name_cond;
-
amazing, what dont you know?
-
K, Now, the guy wants me to do away with selecting a certain company and want me to sort the list by prority, do you know how I would then link to the other page...(somewhat like this?)
PHP Code:
print "<TD ALIGN=CENTER><a href=showactivity.php?priority=$prioritya, $priorityb, $priorityc&start=$startdate&end=$enddate>".$result['c_name']."</TD>";
then should my select statement on the next page be
select c_name, c_state, c_city, contact_name, contact_phone, a_desc, a_next, medivas,
DATE_FORMAT(a_date, '%m/%d/%Y') as a_date_formatted from company, activity
where c_id = a_c_id and
priority = '$priority' and
a_date between '$start' and '$end'
Last edited by lukeurtnowski; 07-12-2005 at 01:34 PM.
-
I am not realy clear..
You dont have to put priority in the search condition.
print "<TD ALIGN=CENTER><a href=showactivity.php?&start=$startdate&end=$endda te>".$result['c_name']."</a></TD>";
And the next page query should be some like:
select c_name, c_state, c_city, contact_name, contact_phone, a_desc, a_next, medivas,
DATE_FORMAT(a_date, '%m/%d/%Y') as a_date_formatted from company, activity
where c_id = a_c_id and
a_date between '$start' and '$end'
and c_name = '$company_name_chosen'
oder by priority asc
-
ok, sounnd good, thanks, i'll try that (your right.....I bet you were a boy genius or something like that) Dop you do this for a living?
Last edited by lukeurtnowski; 07-12-2005 at 02:45 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|