Database returning incorrect results in a PHP table

I have been working on this search and results page project for some time and when I get everything connected I am not getting the results that should be appearing. What I get are all the results from my database in order. When I make adjustments in my PHP script it will randomly change up the results, but I will get the same results no matter what I put into the search bar. Here is my PHP script-

<?php require_once('../Connections/myProjects.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $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; } } $maxRows_Products = 1; $pageNum_Products = 0; if (isset($_GET['pageNum_Products'])) { $pageNum_Products = $_GET['pageNum_Products']; } $startRow_Products = $pageNum_Products * $maxRows_Products; $fieldname_Products = "-1"; if (isset($_GET['field'])) { $fieldname_Products = $_GET['field']; } $searchvalue_Products = "-1"; if (isset($_GET['field'])) { $searchvalue_Products = $_GET['field']; } mysql_select_db($database_myProjects, $myProjects); $query_Products = "SELECT * FROM project, category WHERE project.Category_ID $fieldname_Products LIKE '%$searchvalue_Products'"; $query_limit_Products = sprintf("%s LIMIT %d, %d", $query_Products, $startRow_Products, $maxRows_Products); $Products = mysql_query($query_limit_Products, $myProjects) or die(mysql_error()); $row_Products = mysql_fetch_assoc($Products); if (isset($_GET['totalRows_Products'])) { $totalRows_Products = $_GET['totalRows_Products']; } else { $all_Products = mysql_query($query_Products); $totalRows_Products = mysql_num_rows($all_Products); } $totalPages_Products = ceil($totalRows_Products/$maxRows_Products)-1; ?> <?php do { ?> <?php } while ($row_Products = mysql_fetch_assoc($Products)); ?>
Project_Title Project_Description Project_Image Project_Tools Category_Type
<?php echo $row_Products['Project_Title']; ?> <?php echo $row_Products['Project_Description']; ?> <?php echo $row_Products['Project_Tools']; ?> <?php echo $row_Products['Category_Type']; ?>
<?php mysql_free_result($Products); ?>

PLEASE HELP! I’M DRIVING MYSELF CRAZY!!!

Sponsor our Newsletter | Privacy Policy | Terms of Service