Long story short...
Can I do this?
if (mysql_result($result_section,$cntr) == ('Machine Info.' or 'Machine Information' or 'Machine Info')) {
echo "Etc.";
}
Long version...
Suppose a table looks like this:
+--------------------------------+----------------+------------------------+
| report_name | section | field_desc |
+--------------------------------+----------------+------------------------+
| Air Dryer Operators Log | Customer Info. | Company Name |
| Air Dryer Operators Log | Customer Info. | City |
| Air Dryer Operators Log | Customer Info. | Address Line 2 |
| Air Dryer Operators Log | Customer Info. | Address Line 1 |
| Air Dryer Operators Log | Customer Info. | Company Name |
| Air Dryer Operators Log | Customer Info. | City |
| Air Dryer Operators Log | Customer Info. | Address Line 2 |
| Air Dryer Operators Log | Customer Info. | Address Line 1 |
| Air Dryer Operators Log | Machine Info. | Type of Inspection |
| Air Dryer Operators Log | Machine Info. | Plant ID No. |
| Air Dryer Operators Log | Measurements | Inlet Air Temperature |
| Air Dryer Operators Log | Measurements | Inlet Air Temperature |
| Air Dryer Operators Log | Measurements | Inlet Air Pressure |
| Air Dryer Operators Log | Measurements | Inlet Air Pressure |
| Air Dryer Operators Log | Measurements | Outlet Air Pressure |
| Air Dryer Operators Log | Ratings | Amps |
| Air Dryer Operators Log | Ratings | Voltage |
| Air Dryer Operators Log | Ratings | Voltage |
| Air Dryer Operators Log | Ratings | Amps |
| Air Dryer Operators Log | Ratings | Replacement Element |
| Inspection Report for Air Care | Customer Info. | State |
| Inspection Report for Air Care | Customer Info. | State |
| Inspection Report for Air Care | Machine Info. | Plant ID No. |
| Inspection Report for Air Care | Machine Info. | Type of Inspection |
| Inspection Report for Air Care | Measurements | Outlet Air Pressure |
| Inspection Report for Air Care | Measurements | Outlet Air Temperature |
| Inspection Report for Air Care | Measurements | Outlet Air Temperature |
| Inspection Report for Air Care | Ratings | Replacement Element |
+--------------------------------+----------------+------------------------+
(There are actually many more columns beyond field_desc but you get the point.)
I'm trying to split the report_names into sections, each with their respective subsections so that it looks something like...
-Air Dryer Operator's Log
--Machine Info.
---Dryer Serial No.
---Dryer Model No.
---Etc.
--Customer Info.
---Customer Name
---Customer Address
---Etc.
--Ratings
---Etc.
-Inspection Report for Air Care
--Machine Info.
---Etc.
--Customer Info.
---Etc.
--Visual
---Etc.
I've been trying to use the following code to do it:
for ($cntr = 0; $cntr < $num_rows; $cntr += 1) {
if (mysql_result($result_report_name,$cntr) == $selected_report) {
if (mysql_result($result_section,$cntr) == ('Machine Info.' or 'Machine Information' or 'Machine Info')) {
echo "
<tr><td width=225 align=right valign=middle>",mysql_result($result_field_desc, $cntr),": </td><td width=225 align=left valign=middle><input name=",mysql_result($result_input_name, $cntr)," type=",mysql_result($result_field_type, $cntr),"> ",mysql_result($result_unit_type, $cntr),"</td></tr>
";
}
}
}
And I also wrote the following code that might help me single out where each report_name and section_name change.
for ($cntr = 1; $cntr < $num_rows; $cntr += 1) {
if (mysql_result($result_report_name,$cntr) !== $length_gitr) {
$loop_lengths[$arr_length] = $cntr-1;
$length_gitr[$arr_length] = mysql_result($result_report_name,$cntr);
$arr_length++;
}
}