Question
Display Resuts Based on 2 drop down menus selection
Hi All
I'm using Dreamweaver MX PHP/SQL
I want to display result of database based on the selection ot 2 drop down menu.
I've created a form with 2 drop down menu. first one is employer and the secod is program
I've created a recordset query in the advance mode. here is the SQL statement:
SELECT gradtbl.id, gradtbl.full_name, gradtbl.home_phone, gradtbl.mobile_phone, gradtbl.email
FROM careertbl, gradtbl
WHERE careertbl.emp_id = colname AND gradtbl.program = progdrp AND careertbl.student_id = gradtbl.id
colname and progdrp are Form variables. (I defined them in the varialbles section in the recordset box) as following
NAME Defaulf Value Run-time Value
progdrp 1 $HTTP_POST_VARS['program']
colname 1 $HTTP_POST_VARS['employer']
The problem is with the progdrp.... when I remove it and do the search based on the employer drp It works fine. But when I add the progdrp I got
Unknown column 'ABUS' in 'where clause' (ABUS is my selection)
Below is the generated code
mysql_select_db($database_grad, $grad);
$query_Recordset1 = sprintf("SELECT gradtbl.id, gradtbl.full_name, gradtbl.home_phone, gradtbl.mobile_phone, gradtbl.email FROM careertbl, gradtbl WHERE careertbl.emp_id = %s AND gradtbl.program = %s AND careertbl.student_id = gradtbl.id ", $colname_Recordset1,$progdrp_Recordset1);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $grad) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
Can Any one help me in that
I'm using Dreamweaver MX PHP/SQL
I want to display result of database based on the selection ot 2 drop down menu.
I've created a form with 2 drop down menu. first one is employer and the secod is program
I've created a recordset query in the advance mode. here is the SQL statement:
SELECT gradtbl.id, gradtbl.full_name, gradtbl.home_phone, gradtbl.mobile_phone, gradtbl.email
FROM careertbl, gradtbl
WHERE careertbl.emp_id = colname AND gradtbl.program = progdrp AND careertbl.student_id = gradtbl.id
colname and progdrp are Form variables. (I defined them in the varialbles section in the recordset box) as following
NAME Defaulf Value Run-time Value
progdrp 1 $HTTP_POST_VARS['program']
colname 1 $HTTP_POST_VARS['employer']
The problem is with the progdrp.... when I remove it and do the search based on the employer drp It works fine. But when I add the progdrp I got
Unknown column 'ABUS' in 'where clause' (ABUS is my selection)
Below is the generated code
mysql_select_db($database_grad, $grad);
$query_Recordset1 = sprintf("SELECT gradtbl.id, gradtbl.full_name, gradtbl.home_phone, gradtbl.mobile_phone, gradtbl.email FROM careertbl, gradtbl WHERE careertbl.emp_id = %s AND gradtbl.program = %s AND careertbl.student_id = gradtbl.id ", $colname_Recordset1,$progdrp_Recordset1);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $grad) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
Can Any one help me in that