So why is it that the following code returns data from a single table
just fine? When 'all' is selected, all records are returned or if
another selection is selected, only the ones specific to that group
are returned for a single table. Code follows.
$query =
"SELECT *
FROM $table
WHERE 1 = 1 ";
if($area != "All") $query .= "and area = '".$area."'" ;
$result = mysql_query($qu ery);
------------------------------------------------------------------------------------------------------------
but where two tables have been successfully joined from a single form
and data from the form is going into 2 separate tables I run into
trouble on the query. The 'all' still returns everything as it
should, pulling data from the two tables but individual selections
used in a query form drop down that includes 'all' (i.e. to narrow to
more specific areas), will not work any longer?
$query =
"SELECT shakers.area, shakers.equipna me, shakers.equipno ,
shakers.coupler , motors.mccloc, motors.hp, motors.frame, motors.amps,
motors.rpm, shakers.notes
FROM shakers, motors
WHERE shakers.equipno = motors.equipno ";
if($area != "All") $query .= "and area = '".$area."'" ;
$result = mysql_query($qu ery);
thanks again for any replies...
Chris
just fine? When 'all' is selected, all records are returned or if
another selection is selected, only the ones specific to that group
are returned for a single table. Code follows.
$query =
"SELECT *
FROM $table
WHERE 1 = 1 ";
if($area != "All") $query .= "and area = '".$area."'" ;
$result = mysql_query($qu ery);
------------------------------------------------------------------------------------------------------------
but where two tables have been successfully joined from a single form
and data from the form is going into 2 separate tables I run into
trouble on the query. The 'all' still returns everything as it
should, pulling data from the two tables but individual selections
used in a query form drop down that includes 'all' (i.e. to narrow to
more specific areas), will not work any longer?
$query =
"SELECT shakers.area, shakers.equipna me, shakers.equipno ,
shakers.coupler , motors.mccloc, motors.hp, motors.frame, motors.amps,
motors.rpm, shakers.notes
FROM shakers, motors
WHERE shakers.equipno = motors.equipno ";
if($area != "All") $query .= "and area = '".$area."'" ;
$result = mysql_query($qu ery);
thanks again for any replies...
Chris
Comment