Thanks big time man....
Now I have set up a form where they could search for Items base on a category. However, I have the same problem while displaying it on a table. This is the code:
?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_search = "-1";
if (isset($_GET['search'])) {
$colname_search = $_GET['search'];
}
mysql_select_db($database_sin, $sin);
$query_search = sprintf("SELECT * FROM parts WHERE desc_p LIKE %s", GetSQLValueString("%" . $colname_search . "%", "text"));
$search = mysql_query($query_search, $sin) or die(mysql_error());
$row_search = mysql_fetch_assoc($search);
$totalRows_search = mysql_num_rows($search);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IHD DATABASE MODULE</title>
<style type="text/css">
<!--
.style2 {font-size: 18px; font-weight: bold; }
.style7 {font-size: 36px;
color: #009900;
font-weight: bold;
}
body {
background-color: #FFFF00;
}
.style8 {font-size: 18px; color: #FF0000; font-weight: bold; }
.style9 {font-size: 16px; color: #0000FF; }
.style10 {font-size: 18px}
.style11 {
font-size: 16px;
font-weight: bold;
}
.style12 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<p align="center"><span class="style7">IHD DATABASE MODULE </span></p>
<p align="center"><a href="index.php" class="style12"></a></p>
<p align="center" class="style11">Stock item standard formula:</p>
<table width="272" border="1" align="center">
<tr>
<td><div align="center" class="style8">Cat #</div></td>
<td><div align="center" class="style8">Vendor #</div></td>
<td><div align="center" class="style8">Id#</div></td>
</tr>
<tr>
<td><div align="center" class="style10">100</div></td>
<td><div align="center" class="style10">00</div></td>
<td><div align="center" class="style10">0000</div></td>
</tr>
</table>
<p align="center"> </p>
<p align="center"><a href="index.php" class="style12">Back to Search</a></p>
<p> </p>
<table width="705" height="142" border="1" align="center" bgcolor="#00CC00">
<tr>
<td><div align="center" class="style2">Cat</div></td>
<td><div align="center" class="style2">Vendor</div></td>
<td><div align="center" class="style2">Id</div></td>
<td><div align="center" class="style2">Description Parts</div></td>
<td><div align="center" class="style2">Description Sales</div></td>
</tr>
<?php do { ?>
<tr>
<td><div align="center" class="style8"><?php echo $row_search['cat']; ?></div></td>
<td><div align="center" class="style8"><?php echo $row_search['vendor']; ?></div></td>
<td><div align="center" class="style8"><?php echo $row_search['id']; ?></div></td>
<td><div align="center" class="style9"><?php echo $row_search['desc_p']; ?></div></td>
<td><div align="center" class="style9"><?php echo $row_search['desc_s']; ?></div></td>
</tr>
<?php } while ($row_search = mysql_fetch_assoc($search)); ?>
</table>
<p align="center"><a href="index.php" class="style12">Back to Search</a></p>
</body>
</html>
<?php
mysql_free_result($search);
?>
How can I code it so it will show it in the format I explained above.
Thanks