Hi All,
I am wanting to offer a number of drop down boxes (5), allowing user to select any combo of them or all etc. I have spent alot of time reading to try and find out what I have doen wrong, but because I am a newbie to both PHP and SQL, I am struggling to find where I am going wrong. I would really appreciate it if someone could have a look over my code below and tell me where I am going wrong. The code I have listed only inlcludes two search criteria, but I am sure that if I can get that to work, I can get 5 to work.
Thnaks in advance
Hamsterpants
<?php require_once('Connections/connEMI.php'); ?>
<?php
$maxRows_results = 10;
$pageNum_results = 0;
if (isset($HTTP_GET_VARS['pageNum_results'])) {
$pageNum_results = $HTTP_GET_VARS['pageNum_results'];
}
$startRow_results = $pageNum_results * $maxRows_results;
$colname_results = "USA";
if (isset($HTTP_GET_VARS['Country'])) {
$colname_results = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['Country'] : addslashes($HTTP_GET_VARS['Country']);
}
$colname_results = "Pop";
if (isset($HTTP_GET_VARS['Country'])) {
$colname_results = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['Country'] : addslashes($HTTP_GET_VARS['Country']);
}
mysql_select_db($database_connEMI, $connEMI);
$query_results = sprintf("SELECT * FROM web_data WHERE Country = '%s' and Genre = '%s'", $colname_results,$colname_results);
$query_limit_results = sprintf("%s LIMIT %d, %d", $query_results, $startRow_results, $maxRows_results);
$results = mysql_query($query_limit_results, $connEMI) or die(mysql_error());
$row_results = mysql_fetch_assoc($results);
if (isset($HTTP_GET_VARS['totalRows_results'])) {
$totalRows_results = $HTTP_GET_VARS['totalRows_results'];
} else {
$all_results = mysql_query($query_results);
$totalRows_results = mysql_num_rows($all_results);
}
$totalPages_results = ceil($totalRows_results/$maxRows_results)-1;
?>
<html>
<head>
</head>
<body>
<?php do { ?>
<?php echo $row_results['Title']; ?>
<?php } while ($row_results = mysql_fetch_assoc($results)); ?>
</body>
</html>
<?php
mysql_free_result($results);
?>