Data Not Pulling From Table
Posted: 27. December 2012 17:05
I am having an issue with data not pulling from a table. The information is pulled via two files. The first is a form to capture tag numbers from inventory. The second is the actual tag. For some reason the file that creates the tag is not pulling the information from the database based on the tag numbers. I have a feeling that it is how the query is coded, but I am not having any luck. I am using a program called PHP Runner to aid in writing the code along with a lot of other custom coding. When I run the site and view from localhost, the information is there, but when I view the site from the IP address on a workstation, the information is gone, the table structure is gone, and the field headers are all at the top of the page and run together.
Below is the coding for the the page. Any help on this would greatly be appreciated.
<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
include("include/dbcommon.php");
include("include/_users_variables.php");
$filename="";
$message="";
$error_happened=false;
$readevalues=false;
//connect database
$conn = db_connect();
Function strempty($input)
{
if($input != '')
{
return $input;
}else{
$strrpl = "---";
return $strrpl;
}
}
?>
<link REL="stylesheet" href="include/style.css" type="text/css">
<html>
<body>
<?php
global $conn;
$query = "SELECT * FROM _equipment_in_stock Tag_ID, Type, Department, Attention, Category, Customer, Store_Number, Part_Number, Model_Number, Serial_Number, Color, Size, Description from _equipment_in_stock where Tag_ID BETWEEN '".$_POST['starttag']."' AND '".$_POST['endtag']."' ";
$result = mysql_query($query, $conn);
while ($row = mysql_fetch_array($result))
{
?>
<br>
<table border="2" width=100% cellspacing="2">
<tr bgcolor="#efefef">
<td width="33%" valign="top" align="center"><font size="5">TYPE</font></td>
<td width="33%" valign="top" align="center"><font size="5">DEPARTMENT</font></td>
<td width="33%" valign="top" align="center"><font size="5">ATTENTION</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo $row['Type'];?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo $row['Department'];?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo $row['Attention'];?></font></td>
</tr>
<tr bgcolor="#efefef">
<td valign="top" align="center"><font size="5">CATEGORY</font></td>
<td valign="top" align="center"><font size="5">CUSTOMER</font></td>
<td valign="top" align="center"><font size="5">STORE NUMBER</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Category']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Customer']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Store_Number']);?></font></td>
</tr>
<tr bgcolor="#efefef">
<td valign="top" align="center"><font size="5">PART NUMBER</font></td>
<td valign="top" align="center"><font size="5">MODEL NUMBER</font></td>
<td valign="top" align="center"><font size="5">SERIAL NUMBER</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Part_Number']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Model_Number']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Serial_Number']);?></font></td>
</tr>
<tr bgcolor="#efefef">
<td valign="top" align="center"><font size="5">COLOR</font></td>
<td valign="top" align="center"><font size="5">SIZE</font></td>
<td valign="top" align="center"><font size="5">DESCRIPTION</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Color']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Size']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Description']);?></font></td>
</tr>
<tr>
<td height="418" valign="middle" align="center" colspan="3">
<span id="huge"><? echo $row['Tag_ID'];?></span><br>
<span id="barcode"><? echo $row['Tag_ID'];?></span><br>
</td>
</tr>
</table><br><Br>
<p style="page-break-after: auto"><?
}
?>
</p>
</body>
</html>
Below is the coding for the the page. Any help on this would greatly be appreciated.
<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
include("include/dbcommon.php");
include("include/_users_variables.php");
$filename="";
$message="";
$error_happened=false;
$readevalues=false;
//connect database
$conn = db_connect();
Function strempty($input)
{
if($input != '')
{
return $input;
}else{
$strrpl = "---";
return $strrpl;
}
}
?>
<link REL="stylesheet" href="include/style.css" type="text/css">
<html>
<body>
<?php
global $conn;
$query = "SELECT * FROM _equipment_in_stock Tag_ID, Type, Department, Attention, Category, Customer, Store_Number, Part_Number, Model_Number, Serial_Number, Color, Size, Description from _equipment_in_stock where Tag_ID BETWEEN '".$_POST['starttag']."' AND '".$_POST['endtag']."' ";
$result = mysql_query($query, $conn);
while ($row = mysql_fetch_array($result))
{
?>
<br>
<table border="2" width=100% cellspacing="2">
<tr bgcolor="#efefef">
<td width="33%" valign="top" align="center"><font size="5">TYPE</font></td>
<td width="33%" valign="top" align="center"><font size="5">DEPARTMENT</font></td>
<td width="33%" valign="top" align="center"><font size="5">ATTENTION</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo $row['Type'];?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo $row['Department'];?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo $row['Attention'];?></font></td>
</tr>
<tr bgcolor="#efefef">
<td valign="top" align="center"><font size="5">CATEGORY</font></td>
<td valign="top" align="center"><font size="5">CUSTOMER</font></td>
<td valign="top" align="center"><font size="5">STORE NUMBER</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Category']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Customer']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Store_Number']);?></font></td>
</tr>
<tr bgcolor="#efefef">
<td valign="top" align="center"><font size="5">PART NUMBER</font></td>
<td valign="top" align="center"><font size="5">MODEL NUMBER</font></td>
<td valign="top" align="center"><font size="5">SERIAL NUMBER</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Part_Number']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Model_Number']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Serial_Number']);?></font></td>
</tr>
<tr bgcolor="#efefef">
<td valign="top" align="center"><font size="5">COLOR</font></td>
<td valign="top" align="center"><font size="5">SIZE</font></td>
<td valign="top" align="center"><font size="5">DESCRIPTION</font></td>
</tr>
<tr>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Color']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Size']);?></font></td>
<td height="70" valign="middle" align="center"><font size="5"><? echo strempty($row['Description']);?></font></td>
</tr>
<tr>
<td height="418" valign="middle" align="center" colspan="3">
<span id="huge"><? echo $row['Tag_ID'];?></span><br>
<span id="barcode"><? echo $row['Tag_ID'];?></span><br>
</td>
</tr>
</table><br><Br>
<p style="page-break-after: auto"><?
}
?>
</p>
</body>
</html>