Reply to Query Problem

Your name:

Reply:


Posted by cover on 01/02/06 07:17

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($query);


------------------------------------------------------------------------------------------------------------
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.equipname, 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($query);

thanks again for any replies...

Chris

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация