Jump to content

Cannot figure out whats wrong in code!


divadiva

Recommended Posts

Experts

I have these two php pages "ViewInventory" and "EditInventory".Basicall they are forms.With View I can see manufacturer ,process and alike information.Whereas in Edit I have the capability to edit.

View  have words field,in which I can enter anything and if there is some related data in the database it will popup.For some reason if I enter anyword in the "word" field in "ViewInventory" it doesnt return any result.I cannot  figure out the error in it.

Below is the code for View .I will appreciate your help.

[b]VIEW INVENTORY(words field not working)[/b]
<? include('template.inc'); verify('viewinvent.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML> 
 <HEAD> 
 <TITLE>Page; Inventory Database > View
	Inventory</TITLE> <LINK REL="stylesheet" TYPE="text/css" HREF="style.css"> 
 </HEAD> 
 <BODY> 
 <FORM ACTION="viewinvent.php" METHOD="POST">
 <%
 template('Inventory Database > View Inventory');
 function main() {
  globvars('dlist', 'view', 'smanuf', 'sprocess', 'swafer', 'sstatus', 'slocation', 'sfund', 'swords', 'sorder', 'sdisp', 'skip');

global $globvars; extract($globvars) ;

// build inv status array
$result = mysql_query( "SELECT * FROM `inv_status` ORDER BY `status`" );
while($a_row = mysql_fetch_array($result)){
	$stv = $a_row['status'];
	$globvars['inv_status'][$stv] = $a_row['status_desc'];
}

$globvars['msg'] = null ;

if($view) {
	dview();
}
elseif($dlist) {
	dlist();
}
else {
	slist();
}
}
 
 function slist() {
global $globvars; extract($globvars) ;
 %>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD> <B>Select Items</B></TD> 
		 </TR> 
		 <TR> 
			<TD><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20" BORDER="0"
			  ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD> 
			  <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD> 
						 <TABLE CELLSPACING="0" CELLPADDING="4" BORDER="0" WIDTH="450"> 
							<TBODY> 
							  <TR> 
								 <TD><B>Manufacturer</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="smanuf" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `manufacturers`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['man_name'] . '">' . $a_row['man_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR> 
								 <TD><B>Process</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="sprocess" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `process` ORDER BY `pro_name`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['pro_name'] . '">' . $a_row['pro_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR> 
								 <TD WIDTH="190"><B>Wafer Size</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="swafer" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `wafers` ORDER BY `mm`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['mm'] . '">' . $a_row['mm'] . ' mm' . ' (' . $a_row['inch'] . '")</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Words</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<INPUT TYPE="TEXT" NAME="swords" MAXLENGTH="40"
									 STYLE="width:250px;"></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Status</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sstatus" SIZE="1"> 
									  <OPTION VALUE="A">(All)</OPTION> 
									  <OPTION VALUE="N" SELECTED="SELECTED">(All not
										 sold)</OPTION> 
<% 
foreach($inv_status as $this_status => $this_desc){
print '<OPTION VALUE="' . $this_status . '">' . $this_desc . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Location</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="slocation" SIZE="1"> 
									  <OPTION VALUE="A">(All)</OPTION> 
<% 
$result = mysql_query( "SELECT * FROM `locations` WHERE `loc_name` != ''" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['loc_ref'] . '">' . $a_row['loc_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Fund</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sfund" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION> 
<% 
$result = mysql_query( "SELECT * FROM `funds`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['fund'] . '">' . $a_row['fund'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Sort By</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sorder" SIZE="1"> 
									  <OPTION VALUE="inventory_id">inventory_id</OPTION> 
									  <OPTION VALUE="tool_id">tool_id</OPTION> 
									  <OPTION VALUE="process"
										SELECTED="SELECTED">Process</OPTION> 
									  <OPTION VALUE="manufacturer">Manufacturer</OPTION> 
									  <OPTION VALUE="model">Model</OPTION> 
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Show/page</B></TD> 
								 <TD VALIGN="MIDDLE"> 
									<INPUT TYPE="TEXT" NAME="sdisp" MAXLENGTH="10"
									 STYLE="width:50px;" VALUE="50"></TD> 
								 <TD VALIGN="MIDDLE" ALIGN="RIGHT"> 
									<INPUT TYPE="HIDDEN" NAME="dlist" VALUE="1"> 
									<INPUT TYPE="SUBMIT" VALUE="Search" CLASS="Button"></TD> 
							  </TR> 
							</TBODY> 
						 </TABLE> </TD> 
					</TR> 
				 </TBODY> 
			  </TABLE> </TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>  
 <%
 }

 function dlist() {
global $globvars; extract($globvars) ;
$fstring = "( 1 = 1 )" ;
		%>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD><B>Search Results</B></TD> 
			<TD ALIGN="RIGHT" CLASS="red"><A HREF="viewinvent.php">New Search</A></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE CELLSPACING="1" CELLPADDING="2" BORDER="0" WIDTH="100%"
				CLASS="dtable"> 
				 <TBODY> 
					<TR VALIGN="MIDDLE"> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="16%">Manufacturer</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Process</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Wafer</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Words</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Status</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Location</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Fund</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Sort</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Found</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Displaying</TH> 
					</TR> 
					<TR VALIGN="MIDDLE"> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	if ( $smanuf ){
										$fstring .= " AND ( `manufacturer` = '$smanuf' ) ";
										print $smanuf;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%if ( $sprocess ) {
										$fstring .= " AND ( `process` = '$sprocess' ) ";
										print $sprocess;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	
									if ( $swafer ) {
										$fstring .= " AND ( '$swafer' >= `wafer_min` AND '$swafer' <= `wafer_max` ) ";
										print $swafer . ' mm';
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><% if ($swords){
									print $swords;
									$fstring .= " AND ( `description` REGEXP '$swords' 
									OR `configuration` REGEXP '$swords' 
									OR `software` REGEXP '$swords' 
									OR `hardware` REGEXP '$swords' 
									OR `model` REGEXP '$swords' 
									OR `manufacturers` REGEXP '$swords' 
									OR `process` REGEXP '$swords' 
									OR `inventory_id` REGEXP '$swords' 
									OR `tool_id` REGEXP '$swords' )";
							} else {
									print 'N/A';
							}
							%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	
									if ( $sstatus == 'N' ) {
										$fstring .= " AND ( `status_inv` < 4 ) ";
										print 'All not sold' ;
									}
									elseif ( $sstatus != 'A' ) {
										$fstring .= " AND ( `status_inv` = '$sstatus' ) ";
										print $inv_status[$sstatus] ;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if( $slocation == 'A' ) {
						print 'All' ;
					}
					else {
						$string = "SELECT * FROM `locations` WHERE `loc_ref` = '$slocation' " ;
						// print $string ;
						$locs = mysql_query( "$string" );
						$l_row = mysql_fetch_array($locs) ;
						print $l_row['loc_name'] ;
						$fstring .= " AND ( `loc_ref` = '$slocation' ) ";							
					}						   
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if($sfund) {
						print $sfund ;
						$fstring .= " AND ( `fund` = '$sfund' ) ";
					}
					else {
						print 'All' ;
					}							
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%= $sorder ; %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if($sdisp>5) {
						$maxdisp = $sdisp ;
					}
					else {
						$maxdisp = 50 ;
					}

					if($fstring) {
						$fstring = " WHERE $fstring ";
					}

					if($sorder) {
						$fstring .= " ORDER BY $sorder";
					}

					$string = "SELECT * FROM `inventory` $fstring " ;
					// print $string ;
					$agres = mysql_query( "$string" );

					if ( $agres && mysql_num_rows($agres) ) {
						$agtot = mysql_num_rows($agres);
						print $agtot;
					}
					else {
						$agtot = 0 ;
						print '0';
					} 
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					// displaying range;
					if ( $skip ) {
						$sfr = $skip + 1 ;
					}
					elseif(!$agtot) {
						$sfr = 0 ;
					}
					else {
						$sfr = 1 ;
					}
					print $sfr . ' - ' ;
					if ( ( $skip + $maxdisp ) <= $agtot ) {
						$sto = $skip + $maxdisp ;
					}
					else {
						$sto = $agtot ;
					}
					print $sto ;
					%></TD> 
					</TR> 
				 </TBODY> 
			  </TABLE> </TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TH ALIGN="LEFT">Inv_id</TH> 
					  <TH ALIGN="LEFT">tool_id</TH> 
					  <TH ALIGN="LEFT">Process</TH> 
					  <TH ALIGN="LEFT">Manufacturer</TH> 
					  <TH ALIGN="LEFT">Model</TH> 
					  <TH ALIGN="LEFT">Description</TH> 
					  <TH ALIGN="LEFT">Status</TH> 
					</TR> 

		 <% 

		$rdisp = 0 ;
		if ($skip>0) {
			$rprev = $skip - $maxdisp ;
		}
		else {
			$rprev = 0 ;
			$skip = 0; 
		}		

		if ($skip < $agtot) {
			if ( $skip ) {
				// skip if necessary
				mysql_data_seek( $agres , $skip );
			}
			$skipt = 0 ;
		 	while($i_row=mysql_fetch_array($agres)) { 
				if( $rdisp >= $maxdisp ) { 
					break ;
				}
				$rdisp++ ;					
		 		%>
					<TR> 
					  <TD><%=
						 $i_row['inventory_id'] ; %></TD> 
					  <TD><A
						 HREF="<%= 'viewinvent.php?view=' . $i_row['inventory_id'] . '&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder)  ; %>">
						 <%
						 if($i_row['tool_id']) {
						 	print $i_row['tool_id'] ;
						 }
						 else {
						 	print 'N/A';
						 }
						 %>
						 </A></TD> 
					  <TD><%= $i_row['process'] ; %></TD> 
					  <TD><%= $i_row['manufacturer'] ; %></TD> 
					  <TD><%= $i_row['model'] ; %></TD> 
					  <TD><%= $i_row['description'] ; %></TD> 
					  <TD>
					  <% 
					  $is = $i_row['status_inv'] ;
					  print $inv_status[$is];
					  %></TD> 
					</TR>
		 <%} }%>
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD CLASS="btt" ALIGN="LEFT" WIDTH="5%"> <% if ( $skip > 0 ) { %><A
						 HREF="<%= 'viewinvent.php?dlist=1&skip=' . $rprev . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Previous</A>
								 <% }
								 	else {
									%>
						 <FONT COLOR="#BBBBBB">Previous</FONT>
									<%	}  %>
					  </TD> 
					  <TD ALIGN="CENTER" WIDTH="90%"><%
			  $ng = 0 ;
			  for( $np = 0 ; $np < 50 ; $np++ ) {
			  	if($np) {
			  		$sel = $np * $maxdisp ;
				}
				else {
			  		$sel = 0 ;
				}
			  	if( $sel >= $agtot ) {
					break ;
				}
			  	$ng++ ;
				if( ( $skip && ( $sel == $skip ) ) || ( $ng == 1 && !$skip ) ) {
					print $ng ;
				}
				else {
					%><A
						 HREF="<%= 'viewinvent.php?dlist=1&skip=' . $sel . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>"><%=
						 $ng ; %></A><%
				}
				%>  <%
			  } 
			  %></TD> 
					  <TD CLASS="btt" ALIGN="RIGHT" WIDTH="5%"> <% $skip = $skip + $rdisp ;
								 	if ( $skip < $agtot ) { %>
						 <A
						  HREF="<%= 'viewinvent.php?dlist=1&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Next</A>
								 <% }
								 	else {
									%>
						 <FONT COLOR="#BBBBBB">Next</FONT>
									<%	}  %>
					  </TD> 
					</TR> 
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>	
<%
 }
 
 function dview() {
global $globvars; extract($globvars) ;
$string = "SELECT * FROM `inventory` LEFT JOIN `locations` ON inventory.loc_ref=locations.loc_ref WHERE inventory.inventory_id = '$view' LIMIT 1";
$item = mysql_query("$string");
$i_row=mysql_fetch_array($item);	
 	%>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD> <B>Inventory Item</B></TD> 
			<TD ALIGN="CENTER"><A HREF="<%= '../details1.php?ref=' . $view ; %>"
			  TARGET="_blank">Print Datasheet</A></TD> 
			<TD ALIGN="CENTER"><A HREF="viewinvent.php">New Search</A></TD> 
			<TD ALIGN="RIGHT"><A
			  HREF="<%= 'viewinvent.php?dlist=1&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Return
			  to list</A></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="4"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="4"> 
			  <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Inventory
						 id</B></TD> 
					  <TD><%= $i_row['inventory_id'] ; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Tool id</B></TD>
					  
					  <TD><%= $i_row['tool_id']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Purchase
						 Date</B></TD> 
					  <TD><%= ddate($i_row['purchase_date'],'',''); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Status</B></TD> 
					  <TD><% 
					  $is = $i_row['status_inv'] ;
					  print $inv_status[$is];
					  %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Process</B></TD>
					  
					  <TD><%= $i_row['process']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Manufacturer</B></TD> 
					  <TD><%= $i_row['manufacturer']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Model</B></TD> 
					  <TD><%= $i_row['model']; %></TD> 
					</TR> 
					<TR>
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Fund</B></TD>
					  <TD><%= $i_row['fund']; %></TD>
					</TR>
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Line
						 Number</B></TD> 
					  <TD>
					  <%= $i_row['line_number']; %>
					  </TD> 
					</TR>
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Serial
						 Number</B></TD> 
					  <TD><%= $i_row['serial_number']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>ECCN</B></TD> 
					  <TD><%= $i_row['eccn']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Schedule B
						 Code</B></TD> 
					  <TD><%= $i_row['schedule_b']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>ICN
						 Code</B></TD> 
					  <TD><%= $i_row['icn_code']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Description</B></TD> 
					  <TD><%= disp($i_row['description']); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Configuration</B></TD> 
					  <TD><%
						if($i_row['configuration']) {
							print disp($i_row['configuration']); 
						}
						if($i_row['configuration']&&$i_row['configuration_file']) {
							print '<BR><BR>';
						}
					  if($i_row['configuration_file']) { %><A
						 HREF="<%= '../files/' . $i_row['configuration_file']; %>" TARGET="_blank">View File</A>
					  <% } %>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Software</B></TD> 
					  <TD><%
						if($i_row['software']) {
							print disp($i_row['software']); 
						}
						if($i_row['software']&&$i_row['software_file']) {
							print '<BR><BR>';
						}
						if($i_row['software_file']) { %><A
						 HREF="<%= '../files/' . $i_row['software_file']; %>" TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Hardware</B></TD> 
					  <TD><%
						if($i_row['hardware']) {
							print disp($i_row['hardware']); 
						}
						if($i_row['hardware']&&$i_row['hardware_file']) {
							print '<BR><BR>';
						}
					  if($i_row['hardware_file']) { %><A
						 HREF="<%= '../files/' . $i_row['hardware_file']; %>" TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Notes</B></TD> 
					  <TD><%
						if($i_row['notes']) {
							print disp($i_row['notes']); 
						}
						if($i_row['notes']&&$i_row['notes_file']) {
							print '<BR><BR>';
						}
					  if($i_row['notes_file']) { %><A HREF="<%= '../files/' . $i_row['notes_file']; %>"
						 TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Condition</B></TD> 
					  <TD><%= $i_row['condition']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>In
						 Production</B></TD> 
					  <TD><%= ddate($i_row['in_production'],'d F Y','N/A'); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Shutdown
						 Conditions</B></TD> 
					  <TD><%= $i_row['shutdown_conditions']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Wafer</B></TD> 
					  <TD>
					<%
					if($i_row['wafer_min']==$i_row['wafer_max']) {
						print $i_row['wafer_min'] . ' mm' ;
					}
					else {
					   print $i_row['wafer_min'] . ' to ' . $i_row['wafer_max'] . ' mm' ; 
					}
					%>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Facility
						 Requirements</B></TD> 
					  <TD><%= $i_row['facility_reqs']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Footprint</B></TD> 
					  <TD><%= $i_row['footprint']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Price</B></TD> 
					  <TD><%
					  if($i_row['price']) {
					   print '$ ' .  number_format($i_row['price'],0); 
					  }
					%></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 1</B></TD>
					  
					  <TD><% if($i_row['image1'] && ! substr_count($i_row['image1'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['image1']; %>" ALT=" " WIDTH="300"><% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 2</B></TD>
					  
					  <TD><% if($i_row['image2'] && ! substr_count($i_row['image2'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['image2']; %>" ALT=" " WIDTH="300"><% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Drawing</B></TD>
					  
					  <TD><% if($i_row['drawing'] && ! substr_count($i_row['drawing'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['drawing']; %>" ALT=" " WIDTH="300"><% } %></TD>
					  
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Admin
						 Notes</B></TD> 
					  <TD><%= disp($i_row['admin_notes']); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Location</B></TD> 
					  <TD>
					  <%
					  if($i_row['loc_other']) {
					  	print $i_row['loc_other']; 
					  }
					  else {
					  	print $i_row['loc_name']; 
					  }
					  %>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Added</B></TD> 
					  <TD><%= ddate($i_row['added'],'d F Y','N/A'); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Added
						 By</B></TD> 
					  <TD><%= $i_row['added_by']; %></TD> 
					</TR> 
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>
 	<%
 }
 
 %></FORM> </BODY>
</HTML>

       

 

Thanks in advance.

 

 

Link to comment
https://forums.phpfreaks.com/topic/109740-cannot-figure-out-whats-wrong-in-code/
Share on other sites

Sorry about that .Here is teh modified code in tags.

 

<? include('template.inc'); verify('viewinvent.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML> 
 <HEAD> 
 <TITLE>Page; Inventory Database > View
	Inventory</TITLE> <LINK REL="stylesheet" TYPE="text/css" HREF="style.css"> 
 </HEAD> 
 <BODY> 
 <FORM ACTION="viewinvent.php" METHOD="POST">
 <%
 template('Inventory Database > View Inventory');
 function main() {
  globvars('dlist', 'view', 'smanuf', 'sprocess', 'swafer', 'sstatus', 'slocation', 'sfund', 'swords', 'sorder', 'sdisp', 'skip');

global $globvars; extract($globvars) ;

// build inv status array
$result = mysql_query( "SELECT * FROM `inv_status` ORDER BY `status`" );
while($a_row = mysql_fetch_array($result)){
	$stv = $a_row['status'];
	$globvars['inv_status'][$stv] = $a_row['status_desc'];
}

$globvars['msg'] = null ;

if($view) {
	dview();
}
elseif($dlist) {
	dlist();
}
else {
	slist();
}
}
 
 function slist() {
global $globvars; extract($globvars) ;
 %>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD> <B>Select Items</B></TD> 
		 </TR> 
		 <TR> 
			<TD><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20" BORDER="0"
			  ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD> 
			  <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD> 
						 <TABLE CELLSPACING="0" CELLPADDING="4" BORDER="0" WIDTH="450"> 
							<TBODY> 
							  <TR> 
								 <TD><B>Manufacturer</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="smanuf" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `manufacturers`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['man_name'] . '">' . $a_row['man_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR> 
								 <TD><B>Process</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="sprocess" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `process` ORDER BY `pro_name`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['pro_name'] . '">' . $a_row['pro_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR> 
								 <TD WIDTH="190"><B>Wafer Size</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="swafer" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `wafers` ORDER BY `mm`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['mm'] . '">' . $a_row['mm'] . ' mm' . ' (' . $a_row['inch'] . '")</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Words</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<INPUT TYPE="TEXT" NAME="swords" MAXLENGTH="40"
									 STYLE="width:250px;"></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Status</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sstatus" SIZE="1"> 
									  <OPTION VALUE="A">(All)</OPTION> 
									  <OPTION VALUE="N" SELECTED="SELECTED">(All not
										 sold)</OPTION> 
<% 
foreach($inv_status as $this_status => $this_desc){
print '<OPTION VALUE="' . $this_status . '">' . $this_desc . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Location</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="slocation" SIZE="1"> 
									  <OPTION VALUE="A">(All)</OPTION> 
<% 
$result = mysql_query( "SELECT * FROM `locations` WHERE `loc_name` != ''" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['loc_ref'] . '">' . $a_row['loc_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Fund</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sfund" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION> 
<% 
$result = mysql_query( "SELECT * FROM `funds`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['fund'] . '">' . $a_row['fund'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Sort By</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sorder" SIZE="1"> 
									  <OPTION VALUE="inventory_id">inventory_id</OPTION> 
									  <OPTION VALUE="tool_id">tool_id</OPTION> 
									  <OPTION VALUE="process"
										SELECTED="SELECTED">Process</OPTION> 
									  <OPTION VALUE="manufacturer">Manufacturer</OPTION> 
									  <OPTION VALUE="model">Model</OPTION> 
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Show/page</B></TD> 
								 <TD VALIGN="MIDDLE"> 
									<INPUT TYPE="TEXT" NAME="sdisp" MAXLENGTH="10"
									 STYLE="width:50px;" VALUE="50"></TD> 
								 <TD VALIGN="MIDDLE" ALIGN="RIGHT"> 
									<INPUT TYPE="HIDDEN" NAME="dlist" VALUE="1"> 
									<INPUT TYPE="SUBMIT" VALUE="Search" CLASS="Button"></TD> 
							  </TR> 
							</TBODY> 
						 </TABLE> </TD> 
					</TR> 
				 </TBODY> 
			  </TABLE> </TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>  
 <%
 }

 function dlist() {
global $globvars; extract($globvars) ;
$fstring = "( 1 = 1 )" ;
		%>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD><B>Search Results</B></TD> 
			<TD ALIGN="RIGHT" CLASS="red"><A HREF="viewinvent.php">New Search</A></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE CELLSPACING="1" CELLPADDING="2" BORDER="0" WIDTH="100%"
				CLASS="dtable"> 
				 <TBODY> 
					<TR VALIGN="MIDDLE"> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="16%">Manufacturer</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Process</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Wafer</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Words</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Status</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Location</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Fund</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Sort</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Found</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Displaying</TH> 
					</TR> 
					<TR VALIGN="MIDDLE"> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	if ( $smanuf ){
										$fstring .= " AND ( `manufacturer` = '$smanuf' ) ";
										print $smanuf;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%if ( $sprocess ) {
										$fstring .= " AND ( `process` = '$sprocess' ) ";
										print $sprocess;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	
									if ( $swafer ) {
										$fstring .= " AND ( '$swafer' >= `wafer_min` AND '$swafer' <= `wafer_max` ) ";
										print $swafer . ' mm';
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><% if ($swords){
									print $swords;
									$fstring .= " AND ( `description` REGEXP '$swords' 
									OR `configuration` REGEXP '$swords' 
									OR `software` REGEXP '$swords' 
									OR `hardware` REGEXP '$swords' 
									OR `model` REGEXP '$swords' 
									OR `manufacturers` REGEXP '$swords' 
									OR `process` REGEXP '$swords' 
									OR `inventory_id` REGEXP '$swords' 
									OR `tool_id` REGEXP '$swords' )";
							} else {
									print 'N/A';
							}
							%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	
									if ( $sstatus == 'N' ) {
										$fstring .= " AND ( `status_inv` < 4 ) ";
										print 'All not sold' ;
									}
									elseif ( $sstatus != 'A' ) {
										$fstring .= " AND ( `status_inv` = '$sstatus' ) ";
										print $inv_status[$sstatus] ;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if( $slocation == 'A' ) {
						print 'All' ;
					}
					else {
						$string = "SELECT * FROM `locations` WHERE `loc_ref` = '$slocation' " ;
						// print $string ;
						$locs = mysql_query( "$string" );
						$l_row = mysql_fetch_array($locs) ;
						print $l_row['loc_name'] ;
						$fstring .= " AND ( `loc_ref` = '$slocation' ) ";							
					}						   
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if($sfund) {
						print $sfund ;
						$fstring .= " AND ( `fund` = '$sfund' ) ";
					}
					else {
						print 'All' ;
					}							
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%= $sorder ; %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if($sdisp>5) {
						$maxdisp = $sdisp ;
					}
					else {
						$maxdisp = 50 ;
					}

					if($fstring) {
						$fstring = " WHERE $fstring ";
					}

					if($sorder) {
						$fstring .= " ORDER BY $sorder";
					}

					$string = "SELECT * FROM `inventory` $fstring " ;
					// print $string ;
					$agres = mysql_query( "$string" );

					if ( $agres && mysql_num_rows($agres) ) {
						$agtot = mysql_num_rows($agres);
						print $agtot;
					}
					else {
						$agtot = 0 ;
						print '0';
					} 
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					// displaying range;
					if ( $skip ) {
						$sfr = $skip + 1 ;
					}
					elseif(!$agtot) {
						$sfr = 0 ;
					}
					else {
						$sfr = 1 ;
					}
					print $sfr . ' - ' ;
					if ( ( $skip + $maxdisp ) <= $agtot ) {
						$sto = $skip + $maxdisp ;
					}
					else {
						$sto = $agtot ;
					}
					print $sto ;
					%></TD> 
					</TR> 
				 </TBODY> 
			  </TABLE> </TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TH ALIGN="LEFT">Inv_id</TH> 
					  <TH ALIGN="LEFT">tool_id</TH> 
					  <TH ALIGN="LEFT">Process</TH> 
					  <TH ALIGN="LEFT">Manufacturer</TH> 
					  <TH ALIGN="LEFT">Model</TH> 
					  <TH ALIGN="LEFT">Description</TH> 
					  <TH ALIGN="LEFT">Status</TH> 
					</TR> 

		 <% 

		$rdisp = 0 ;
		if ($skip>0) {
			$rprev = $skip - $maxdisp ;
		}
		else {
			$rprev = 0 ;
			$skip = 0; 
		}		

		if ($skip < $agtot) {
			if ( $skip ) {
				// skip if necessary
				mysql_data_seek( $agres , $skip );
			}
			$skipt = 0 ;
		 	while($i_row=mysql_fetch_array($agres)) { 
				if( $rdisp >= $maxdisp ) { 
					break ;
				}
				$rdisp++ ;					
		 		%>
					<TR> 
					  <TD><%=
						 $i_row['inventory_id'] ; %></TD> 
					  <TD><A
						 HREF="<%= 'viewinvent.php?view=' . $i_row['inventory_id'] . '&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder)  ; %>">
						 <%
						 if($i_row['tool_id']) {
						 	print $i_row['tool_id'] ;
						 }
						 else {
						 	print 'N/A';
						 }
						 %>
						 </A></TD> 
					  <TD><%= $i_row['process'] ; %></TD> 
					  <TD><%= $i_row['manufacturer'] ; %></TD> 
					  <TD><%= $i_row['model'] ; %></TD> 
					  <TD><%= $i_row['description'] ; %></TD> 
					  <TD>
					  <% 
					  $is = $i_row['status_inv'] ;
					  print $inv_status[$is];
					  %></TD> 
					</TR>
		 <%} }%>
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD CLASS="btt" ALIGN="LEFT" WIDTH="5%"> <% if ( $skip > 0 ) { %><A
						 HREF="<%= 'viewinvent.php?dlist=1&skip=' . $rprev . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Previous</A>
								 <% }
								 	else {
									%>
						 <FONT COLOR="#BBBBBB">Previous</FONT>
									<%	}  %>
					  </TD> 
					  <TD ALIGN="CENTER" WIDTH="90%"><%
			  $ng = 0 ;
			  for( $np = 0 ; $np < 50 ; $np++ ) {
			  	if($np) {
			  		$sel = $np * $maxdisp ;
				}
				else {
			  		$sel = 0 ;
				}
			  	if( $sel >= $agtot ) {
					break ;
				}
			  	$ng++ ;
				if( ( $skip && ( $sel == $skip ) ) || ( $ng == 1 && !$skip ) ) {
					print $ng ;
				}
				else {
					%><A
						 HREF="<%= 'viewinvent.php?dlist=1&skip=' . $sel . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>"><%=
						 $ng ; %></A><%
				}
				%>  <%
			  } 
			  %></TD> 
					  <TD CLASS="btt" ALIGN="RIGHT" WIDTH="5%"> <% $skip = $skip + $rdisp ;
								 	if ( $skip < $agtot ) { %>
						 <A
						  HREF="<%= 'viewinvent.php?dlist=1&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Next</A>
								 <% }
								 	else {
									%>
						 <FONT COLOR="#BBBBBB">Next</FONT>
									<%	}  %>
					  </TD> 
					</TR> 
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>	
<%
 }
 
 function dview() {
global $globvars; extract($globvars) ;
$string = "SELECT * FROM `inventory` LEFT JOIN `locations` ON inventory.loc_ref=locations.loc_ref WHERE inventory.inventory_id = '$view' LIMIT 1";
$item = mysql_query("$string");
$i_row=mysql_fetch_array($item);	
 	%>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD> <B>Inventory Item</B></TD> 
			<TD ALIGN="CENTER"><A HREF="<%= '../details1.php?ref=' . $view ; %>"
			  TARGET="_blank">Print Datasheet</A></TD> 
			<TD ALIGN="CENTER"><A HREF="viewinvent.php">New Search</A></TD> 
			<TD ALIGN="RIGHT"><A
			  HREF="<%= 'viewinvent.php?dlist=1&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Return
			  to list</A></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="4"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="4"> 
			  <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Inventory
						 id</B></TD> 
					  <TD><%= $i_row['inventory_id'] ; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Tool id</B></TD>
					  
					  <TD><%= $i_row['tool_id']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Purchase
						 Date</B></TD> 
					  <TD><%= ddate($i_row['purchase_date'],'',''); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Status</B></TD> 
					  <TD><% 
					  $is = $i_row['status_inv'] ;
					  print $inv_status[$is];
					  %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Process</B></TD>
					  
					  <TD><%= $i_row['process']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Manufacturer</B></TD> 
					  <TD><%= $i_row['manufacturer']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Model</B></TD> 
					  <TD><%= $i_row['model']; %></TD> 
					</TR> 
					<TR>
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Fund</B></TD>
					  <TD><%= $i_row['fund']; %></TD>
					</TR>
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Line
						 Number</B></TD> 
					  <TD>
					  <%= $i_row['line_number']; %>
					  </TD> 
					</TR>
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Serial
						 Number</B></TD> 
					  <TD><%= $i_row['serial_number']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>ECCN</B></TD> 
					  <TD><%= $i_row['eccn']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Schedule B
						 Code</B></TD> 
					  <TD><%= $i_row['schedule_b']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>ICN
						 Code</B></TD> 
					  <TD><%= $i_row['icn_code']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Description</B></TD> 
					  <TD><%= disp($i_row['description']); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Configuration</B></TD> 
					  <TD><%
						if($i_row['configuration']) {
							print disp($i_row['configuration']); 
						}
						if($i_row['configuration']&&$i_row['configuration_file']) {
							print '<BR><BR>';
						}
					  if($i_row['configuration_file']) { %><A
						 HREF="<%= '../files/' . $i_row['configuration_file']; %>" TARGET="_blank">View File</A>
					  <% } %>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Software</B></TD> 
					  <TD><%
						if($i_row['software']) {
							print disp($i_row['software']); 
						}
						if($i_row['software']&&$i_row['software_file']) {
							print '<BR><BR>';
						}
						if($i_row['software_file']) { %><A
						 HREF="<%= '../files/' . $i_row['software_file']; %>" TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Hardware</B></TD> 
					  <TD><%
						if($i_row['hardware']) {
							print disp($i_row['hardware']); 
						}
						if($i_row['hardware']&&$i_row['hardware_file']) {
							print '<BR><BR>';
						}
					  if($i_row['hardware_file']) { %><A
						 HREF="<%= '../files/' . $i_row['hardware_file']; %>" TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Notes</B></TD> 
					  <TD><%
						if($i_row['notes']) {
							print disp($i_row['notes']); 
						}
						if($i_row['notes']&&$i_row['notes_file']) {
							print '<BR><BR>';
						}
					  if($i_row['notes_file']) { %><A HREF="<%= '../files/' . $i_row['notes_file']; %>"
						 TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Condition</B></TD> 
					  <TD><%= $i_row['condition']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>In
						 Production</B></TD> 
					  <TD><%= ddate($i_row['in_production'],'d F Y','N/A'); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Shutdown
						 Conditions</B></TD> 
					  <TD><%= $i_row['shutdown_conditions']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Wafer</B></TD> 
					  <TD>
					<%
					if($i_row['wafer_min']==$i_row['wafer_max']) {
						print $i_row['wafer_min'] . ' mm' ;
					}
					else {
					   print $i_row['wafer_min'] . ' to ' . $i_row['wafer_max'] . ' mm' ; 
					}
					%>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Facility
						 Requirements</B></TD> 
					  <TD><%= $i_row['facility_reqs']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Footprint</B></TD> 
					  <TD><%= $i_row['footprint']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Price</B></TD> 
					  <TD><%
					  if($i_row['price']) {
					   print '$ ' .  number_format($i_row['price'],0); 
					  }
					%></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 1</B></TD>
					  
					  <TD><% if($i_row['image1'] && ! substr_count($i_row['image1'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['image1']; %>" ALT=" " WIDTH="300"><% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 2</B></TD>
					  
					  <TD><% if($i_row['image2'] && ! substr_count($i_row['image2'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['image2']; %>" ALT=" " WIDTH="300"><% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Drawing</B></TD>
					  
					  <TD><% if($i_row['drawing'] && ! substr_count($i_row['drawing'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['drawing']; %>" ALT=" " WIDTH="300"><% } %></TD>
					  
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Admin
						 Notes</B></TD> 
					  <TD><%= disp($i_row['admin_notes']); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Location</B></TD> 
					  <TD>
					  <%
					  if($i_row['loc_other']) {
					  	print $i_row['loc_other']; 
					  }
					  else {
					  	print $i_row['loc_name']; 
					  }
					  %>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Added</B></TD> 
					  <TD><%= ddate($i_row['added'],'d F Y','N/A'); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Added
						 By</B></TD> 
					  <TD><%= $i_row['added_by']; %></TD> 
					</TR> 
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>
 	<%
 }
 
 %></FORM> </BODY>
</HTML>

so heres the problem yes?

 

as quoted by revraz

i don tknow what the problem is either, could you try explaining a little clearer...

 

I have these two php pages "ViewInventory" and "EditInventory".Basicall they are forms.With View I can see manufacturer ,process and alike information.Whereas in Edit I have the capability to edit.

 

View  have words field,in which I can enter anything and if there is some related data in the database it will popup.For some reason if I enter anyword in the "word" field in "ViewInventory" it doesnt return any result.I cannot  figure out the error in it.

 

Below is the code for View .I will appreciate your help.

 

Experts

 

My apology if my post was unclear.

 

Here is the explanation:

 

I have a php page VIEWInventory.The page looks like this

 

Manufacturer

Process       

Wafer

Word

Status

Location

Fund

Sort By

Show

 

                      SEARCH

 

If I enter all the fields except Word and hit search it works fine.But If I enter anything in word column I get a blank page.The problem is that word field is not working.I am not sure why it doesnot works.

 

Experts If possible please have a look.

 

I have reattached the code:

<? include('template.inc'); verify('viewinvent.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML> 
  <HEAD> 
 <TITLE>Page > Inventory Database > View
	Inventory</TITLE> <LINK REL="stylesheet" TYPE="text/css" HREF="style.css"> 
  </HEAD> 
  <BODY> 
 <FORM ACTION="viewinvent.php" METHOD="POST">
  <%
  template('Inventory Database > View Inventory');
  function main() {
   globvars('dlist', 'view', 'smanuf', 'sprocess', 'swafer', 'sstatus', 'slocation', 'sfund', 'swords', 'sorder', 'sdisp', 'skip');

global $globvars; extract($globvars) ;

// build inv status array
$result = mysql_query( "SELECT * FROM `inv_status` ORDER BY `status`" );
while($a_row = mysql_fetch_array($result)){
	$stv = $a_row['status'];
	$globvars['inv_status'][$stv] = $a_row['status_desc'];
}

$globvars['msg'] = null ;

if($view) {
	dview();
}
elseif($dlist) {
	dlist();
}
else {
	slist();
}
}
  
  function slist() {
global $globvars; extract($globvars) ;
  %>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD> <B>Select Items</B></TD> 
		 </TR> 
		 <TR> 
			<TD><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20" BORDER="0"
			  ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD> 
			  <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD> 
						 <TABLE CELLSPACING="0" CELLPADDING="4" BORDER="0" WIDTH="450"> 
							<TBODY> 
							  <TR> 
								 <TD><B>Manufacturer</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="smanuf" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `manufacturers`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['man_name'] . '">' . $a_row['man_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR> 
								 <TD><B>Process</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="sprocess" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `process` ORDER BY `pro_name`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['pro_name'] . '">' . $a_row['pro_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR> 
								 <TD WIDTH="190"><B>Wafer Size</B></TD> 
								 <TD COLSPAN="2"> 
									<SELECT NAME="swafer" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION>
<% 
$result = mysql_query( "SELECT * FROM `wafers` ORDER BY `mm`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['mm'] . '">' . $a_row['mm'] . ' mm' . ' (' . $a_row['inch'] . '")</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Words</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<INPUT TYPE="TEXT" NAME="swords" MAXLENGTH="40"
									 STYLE="width:250px;"></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Status</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sstatus" SIZE="1"> 
									  <OPTION VALUE="A">(All)</OPTION> 
									  <OPTION VALUE="N" SELECTED="SELECTED">(All not
										 sold)</OPTION> 
<% 
foreach($inv_status as $this_status => $this_desc){
print '<OPTION VALUE="' . $this_status . '">' . $this_desc . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Location</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="slocation" SIZE="1"> 
									  <OPTION VALUE="A">(All)</OPTION> 
<% 
$result = mysql_query( "SELECT * FROM `locations` WHERE `loc_name` != ''" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['loc_ref'] . '">' . $a_row['loc_name'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Fund</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sfund" CLASS="box"> 
									  <OPTION VALUE="">(All)</OPTION> 
<% 
$result = mysql_query( "SELECT * FROM `funds`" );
while($a_row = mysql_fetch_array($result)){
print '<OPTION VALUE="' . $a_row['fund'] . '">' . $a_row['fund'] . '</OPTION>' . "\n"; 
}
%>
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Sort By</B></TD> 
								 <TD VALIGN="MIDDLE" COLSPAN="2"> 
									<SELECT NAME="sorder" SIZE="1"> 
									  <OPTION VALUE="inventory_id">inventory_id</OPTION> 
									  <OPTION VALUE="tool_id">tool_id</OPTION> 
									  <OPTION VALUE="process"
										SELECTED="SELECTED">Process</OPTION> 
									  <OPTION VALUE="manufacturer">Manufacturer</OPTION> 
									  <OPTION VALUE="model">Model</OPTION> 
									</SELECT></TD> 
							  </TR> 
							  <TR VALIGN="MIDDLE"> 
								 <TD VALIGN="MIDDLE"><B>Show/page</B></TD> 
								 <TD VALIGN="MIDDLE"> 
									<INPUT TYPE="TEXT" NAME="sdisp" MAXLENGTH="10"
									 STYLE="width:50px;" VALUE="50"></TD> 
								 <TD VALIGN="MIDDLE" ALIGN="RIGHT"> 
									<INPUT TYPE="HIDDEN" NAME="dlist" VALUE="1"> 
									<INPUT TYPE="SUBMIT" VALUE="Search" CLASS="Button"></TD> 
							  </TR> 
							</TBODY> 
						 </TABLE> </TD> 
					</TR> 
				 </TBODY> 
			  </TABLE> </TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>  
  <%
  }

  function dlist() {
global $globvars; extract($globvars) ;
$fstring = "( 1 = 1 )" ;
		%>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD><B>Search Results</B></TD> 
			<TD ALIGN="RIGHT" CLASS="red"><A HREF="viewinvent.php">New Search</A></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE CELLSPACING="1" CELLPADDING="2" BORDER="0" WIDTH="100%"
				CLASS="dtable"> 
				 <TBODY> 
					<TR VALIGN="MIDDLE"> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="16%">Manufacturer</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Process</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Wafer</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Words</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Status</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Location</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Fund</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Sort</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Found</TH> 
					  <TH ALIGN="left" VALIGN="MIDDLE" WIDTH="12%">Displaying</TH> 
					</TR> 
					<TR VALIGN="MIDDLE"> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	if ( $smanuf ){
										$fstring .= " AND ( `manufacturer` = '$smanuf' ) ";
										print $smanuf;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%if ( $sprocess ) {
										$fstring .= " AND ( `process` = '$sprocess' ) ";
										print $sprocess;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	
									if ( $swafer ) {
										$fstring .= " AND ( '$swafer' >= `wafer_min` AND '$swafer' <= `wafer_max` ) ";
										print $swafer . ' mm';
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><% if ($swords){
									print $swords;
									$fstring .= " AND ( `description` REGEXP '$swords' 
									OR `configuration` REGEXP '$swords' 
									OR `software` REGEXP '$swords' 
									OR `hardware` REGEXP '$swords' 
									OR `model` REGEXP '$swords' 
									OR `manufacturers` REGEXP '$swords' 
									OR `process` REGEXP '$swords' 
									OR `inventory_id` REGEXP '$swords' 
									OR `tool_id` REGEXP '$swords' )";
							} else {
									print 'N/A';
							}
							%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%	
									if ( $sstatus == 'N' ) {
										$fstring .= " AND ( `status_inv` < 4 ) ";
										print 'All not sold' ;
									}
									elseif ( $sstatus != 'A' ) {
										$fstring .= " AND ( `status_inv` = '$sstatus' ) ";
										print $inv_status[$sstatus] ;
									} 
									else {
										print 'All';
									} %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if( $slocation == 'A' ) {
						print 'All' ;
					}
					else {
						$string = "SELECT * FROM `locations` WHERE `loc_ref` = '$slocation' " ;
						// print $string ;
						$locs = mysql_query( "$string" );
						$l_row = mysql_fetch_array($locs) ;
						print $l_row['loc_name'] ;
						$fstring .= " AND ( `loc_ref` = '$slocation' ) ";							
					}						   
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if($sfund) {
						print $sfund ;
						$fstring .= " AND ( `fund` = '$sfund' ) ";
					}
					else {
						print 'All' ;
					}							
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%= $sorder ; %></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					if($sdisp>5) {
						$maxdisp = $sdisp ;
					}
					else {
						$maxdisp = 50 ;
					}

					if($fstring) {
						$fstring = " WHERE $fstring ";
					}

					if($sorder) {
						$fstring .= " ORDER BY $sorder";
					}

					$string = "SELECT * FROM `inventory` $fstring " ;
					// print $string ;
					$agres = mysql_query( "$string" );

					if ( $agres && mysql_num_rows($agres) ) {
						$agtot = mysql_num_rows($agres);
						print $agtot;
					}
					else {
						$agtot = 0 ;
						print '0';
					} 
					%></TD> 
					  <TD ALIGN="left" VALIGN="MIDDLE"><%
					// displaying range;
					if ( $skip ) {
						$sfr = $skip + 1 ;
					}
					elseif(!$agtot) {
						$sfr = 0 ;
					}
					else {
						$sfr = 1 ;
					}
					print $sfr . ' - ' ;
					if ( ( $skip + $maxdisp ) <= $agtot ) {
						$sto = $skip + $maxdisp ;
					}
					else {
						$sto = $agtot ;
					}
					print $sto ;
					%></TD> 
					</TR> 
				 </TBODY> 
			  </TABLE> </TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TH ALIGN="LEFT">Inv_id</TH> 
					  <TH ALIGN="LEFT">tool_id</TH> 
					  <TH ALIGN="LEFT">Process</TH> 
					  <TH ALIGN="LEFT">Manufacturer</TH> 
					  <TH ALIGN="LEFT">Model</TH> 
					  <TH ALIGN="LEFT">Description</TH> 
					  <TH ALIGN="LEFT">Status</TH> 
					</TR> 

		 <% 

		$rdisp = 0 ;
		if ($skip>0) {
			$rprev = $skip - $maxdisp ;
		}
		else {
			$rprev = 0 ;
			$skip = 0; 
		}		

		if ($skip < $agtot) {
			if ( $skip ) {
				// skip if necessary
				mysql_data_seek( $agres , $skip );
			}
			$skipt = 0 ;
		 	while($i_row=mysql_fetch_array($agres)) { 
				if( $rdisp >= $maxdisp ) { 
					break ;
				}
				$rdisp++ ;					
		 		%>
					<TR> 
					  <TD><%=
						 $i_row['inventory_id'] ; %></TD> 
					  <TD><A
						 HREF="<%= 'viewinvent.php?view=' . $i_row['inventory_id'] . '&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder)  ; %>">
						 <%
						 if($i_row['tool_id']) {
						 	print $i_row['tool_id'] ;
						 }
						 else {
						 	print 'N/A';
						 }
						 %>
						 </A></TD> 
					  <TD><%= $i_row['process'] ; %></TD> 
					  <TD><%= $i_row['manufacturer'] ; %></TD> 
					  <TD><%= $i_row['model'] ; %></TD> 
					  <TD><%= $i_row['description'] ; %></TD> 
					  <TD>
					  <% 
					  $is = $i_row['status_inv'] ;
					  print $inv_status[$is];
					  %></TD> 
					</TR>
		 <%} }%>
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="2"> 
			  <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD CLASS="btt" ALIGN="LEFT" WIDTH="5%"> <% if ( $skip > 0 ) { %><A
						 HREF="<%= 'viewinvent.php?dlist=1&skip=' . $rprev . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Previous</A>
								 <% }
								 	else {
									%>
						 <FONT COLOR="#BBBBBB">Previous</FONT>
									<%	}  %>
					  </TD> 
					  <TD ALIGN="CENTER" WIDTH="90%"><%
			  $ng = 0 ;
			  for( $np = 0 ; $np < 50 ; $np++ ) {
			  	if($np) {
			  		$sel = $np * $maxdisp ;
				}
				else {
			  		$sel = 0 ;
				}
			  	if( $sel >= $agtot ) {
					break ;
				}
			  	$ng++ ;
				if( ( $skip && ( $sel == $skip ) ) || ( $ng == 1 && !$skip ) ) {
					print $ng ;
				}
				else {
					%><A
						 HREF="<%= 'viewinvent.php?dlist=1&skip=' . $sel . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>"><%=
						 $ng ; %></A><%
				}
				%>  <%
			  } 
			  %></TD> 
					  <TD CLASS="btt" ALIGN="RIGHT" WIDTH="5%"> <% $skip = $skip + $rdisp ;
								 	if ( $skip < $agtot ) { %>
						 <A
						  HREF="<%= 'viewinvent.php?dlist=1&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Next</A>
								 <% }
								 	else {
									%>
						 <FONT COLOR="#BBBBBB">Next</FONT>
									<%	}  %>
					  </TD> 
					</TR> 
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>	
<%
  }
  
  function dview() {
global $globvars; extract($globvars) ;
$string = "SELECT * FROM `inventory` LEFT JOIN `locations` ON inventory.loc_ref=locations.loc_ref WHERE inventory.inventory_id = '$view' LIMIT 1";
$item = mysql_query("$string");
$i_row=mysql_fetch_array($item);	
  	%>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> 
	  <TBODY> 
		 <TR> 
			<TD> <B>Inventory Item</B></TD> 
			<TD ALIGN="CENTER"><A HREF="<%= '../details1.php?ref=' . $view ; %>"
			  TARGET="_blank">Print Datasheet</A></TD> 
			<TD ALIGN="CENTER"><A HREF="viewinvent.php">New Search</A></TD> 
			<TD ALIGN="RIGHT"><A
			  HREF="<%= 'viewinvent.php?dlist=1&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords)  . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Return
			  to list</A></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="4"><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20"
			  BORDER="0" ALT=" "></TD> 
		 </TR> 
		 <TR> 
			<TD COLSPAN="4"> 
			  <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable"
				WIDTH="100%"> 
				 <TBODY> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Inventory
						 id</B></TD> 
					  <TD><%= $i_row['inventory_id'] ; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Tool id</B></TD>
					  
					  <TD><%= $i_row['tool_id']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Purchase
						 Date</B></TD> 
					  <TD><%= ddate($i_row['purchase_date'],'',''); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Status</B></TD> 
					  <TD><% 
					  $is = $i_row['status_inv'] ;
					  print $inv_status[$is];
					  %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Process</B></TD>
					  
					  <TD><%= $i_row['process']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Manufacturer</B></TD> 
					  <TD><%= $i_row['manufacturer']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Model</B></TD> 
					  <TD><%= $i_row['model']; %></TD> 
					</TR> 
					<TR>
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Fund</B></TD>
					  <TD><%= $i_row['fund']; %></TD>
					</TR>
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Line
						 Number</B></TD> 
					  <TD>
					  <%= $i_row['line_number']; %>
					  </TD> 
					</TR>
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Serial
						 Number</B></TD> 
					  <TD><%= $i_row['serial_number']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>ECCN</B></TD> 
					  <TD><%= $i_row['eccn']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Schedule B
						 Code</B></TD> 
					  <TD><%= $i_row['schedule_b']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>ICN
						 Code</B></TD> 
					  <TD><%= $i_row['icn_code']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Description</B></TD> 
					  <TD><%= disp($i_row['description']); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Configuration</B></TD> 
					  <TD><%
						if($i_row['configuration']) {
							print disp($i_row['configuration']); 
						}
						if($i_row['configuration']&&$i_row['configuration_file']) {
							print '<BR><BR>';
						}
					  if($i_row['configuration_file']) { %><A
						 HREF="<%= '../files/' . $i_row['configuration_file']; %>" TARGET="_blank">View File</A>
					  <% } %>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Software</B></TD> 
					  <TD><%
						if($i_row['software']) {
							print disp($i_row['software']); 
						}
						if($i_row['software']&&$i_row['software_file']) {
							print '<BR><BR>';
						}
						if($i_row['software_file']) { %><A
						 HREF="<%= '../files/' . $i_row['software_file']; %>" TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Hardware</B></TD> 
					  <TD><%
						if($i_row['hardware']) {
							print disp($i_row['hardware']); 
						}
						if($i_row['hardware']&&$i_row['hardware_file']) {
							print '<BR><BR>';
						}
					  if($i_row['hardware_file']) { %><A
						 HREF="<%= '../files/' . $i_row['hardware_file']; %>" TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Notes</B></TD> 
					  <TD><%
						if($i_row['notes']) {
							print disp($i_row['notes']); 
						}
						if($i_row['notes']&&$i_row['notes_file']) {
							print '<BR><BR>';
						}
					  if($i_row['notes_file']) { %><A HREF="<%= '../files/' . $i_row['notes_file']; %>"
						 TARGET="_blank">View File</A>
					  <% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Condition</B></TD> 
					  <TD><%= $i_row['condition']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>In
						 Production</B></TD> 
					  <TD><%= ddate($i_row['in_production'],'d F Y','N/A'); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Shutdown
						 Conditions</B></TD> 
					  <TD><%= $i_row['shutdown_conditions']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Wafer</B></TD> 
					  <TD>
					<%
					if($i_row['wafer_min']==$i_row['wafer_max']) {
						print $i_row['wafer_min'] . ' mm' ;
					}
					else {
					   print $i_row['wafer_min'] . ' to ' . $i_row['wafer_max'] . ' mm' ; 
					}
					%>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Facility
						 Requirements</B></TD> 
					  <TD><%= $i_row['facility_reqs']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Footprint</B></TD> 
					  <TD><%= $i_row['footprint']; %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Price</B></TD> 
					  <TD><%
					  if($i_row['price']) {
					   print '$ ' .  number_format($i_row['price'],0); 
					  }
					%></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 1</B></TD>
					  
					  <TD><% if($i_row['image1'] && ! substr_count($i_row['image1'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['image1']; %>" ALT=" " WIDTH="300"><% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 2</B></TD>
					  
					  <TD><% if($i_row['image2'] && ! substr_count($i_row['image2'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['image2']; %>" ALT=" " WIDTH="300"><% } %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Drawing</B></TD>
					  
					  <TD><% if($i_row['drawing'] && ! substr_count($i_row['drawing'],'unavailable.')) { %><IMG
						 BORDER="0" SRC="<%= '../files/' . $i_row['drawing']; %>" ALT=" " WIDTH="300"><% } %></TD>
					  
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Admin
						 Notes</B></TD> 
					  <TD><%= disp($i_row['admin_notes']); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180"
						STYLE="background-color:#B6DAF2;"><B>Location</B></TD> 
					  <TD>
					  <%
					  if($i_row['loc_other']) {
					  	print $i_row['loc_other']; 
					  }
					  else {
					  	print $i_row['loc_name']; 
					  }
					  %>
					  </TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Added</B></TD> 
					  <TD><%= ddate($i_row['added'],'d F Y','N/A'); %></TD> 
					</TR> 
					<TR> 
					  <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Added
						 By</B></TD> 
					  <TD><%= $i_row['added_by']; %></TD> 
					</TR> 
				 </TBODY> 
			  </TABLE></TD> 
		 </TR> 
	  </TBODY> 
	</TABLE>
  	<%
  }
  
  %></FORM> </BODY>
</HTML>

 

 

I like to help people out, but quite simply there is nowhere to go with this, that's a huge lump of code and we don't

have all your other functions and database to test on.

 

You need to exit where ths offending variable is used, probably after an SQL query is constructed, check its

value and make sure the SQL is valid, and that the database is correct.

 

Try isolating the problem area a little, and if still stuck, post more focused code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.