Hi
I have removed stripslashes as you said it is no longer needed.
I tried the array
$POST['softwareLevel'][0] = 5000;
$POST['softwareLevel'][1] = 6000;
$POST['softwareLevel'][2] = 7000;
$POST['softwareLevel'][3] = 8000;
$_POST['softwareLevel'][4] = 9000;
then run this part
$where = '';
You only need the where clause IF any options have been selected
if (count($_POST['softwareLevel']))
{
Create an array containing as many elements of 'int' as there are
elements in $_POST['softwareLevel']
$types = array_pad(array(), count($_POST['softwareLevel']), 'int');
# Use array map to call GetSQLValueString() for each combination of elements
# in these two arrays, i.e. apply GetSQLValueString using 'int' for all of the input data
$_POST['softwareLevel'] = array_map('GetSQLValueString', $_POST['softwareLevel'], $types);
$where = sprintf(' WHERE titles.level_id IN (%s) ',
implode(', ', $_POST['softwareLevel']));
}
$query = sprintf('SELECT id, title, company, description, resources, location, url, image, keyword, copies FROM titles %s ORDER BY id ASC', $where);
}
Still no results filtered through,
this is the vardump even though I only select 2 options
postarray(2) {
["softwareLevel"]=>
array(5) {
[0]=>
int(5000)
[1]=>
int(6000)
[2]=>
int(7000)
[3]=>
int(8000)
[4]=>
int(9000)
}
["button"]=>
string(6) "Submit"
}
$colname_rsTitles = "-1";
if (isset($_GET['id'])) {
$colname_rsTitles = $_GET['id'];
}
mysql_select_db($database_abe, $abe);
$query_rsTitles = sprintf("SELECT title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE id = %s ORDER BY id ASC", GetSQLValueString($colname_rsTitles, "int"));
$rsTitles = mysql_query($query_rsTitles, $abe) or die(mysql_error());
$row_rsTitles = mysql_fetch_assoc($rsTitles);
$totalRows_rsTitles = "-1";
if (isset($_GET['id'])) {
$totalRows_rsTitles = $_GET['id'];
}
$colname_rs_comments = "-1";
if (isset($_GET['software_id'])) {
$colname_rs_comments = $_GET['software_id'];
}
mysql_select_db($database_abe, $abe);
$query_rsTitles = sprintf("SELECT title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE id = %s ORDER BY id ASC", GetSQLValueString($colname_rsTitles, "int"));
$rsTitles = mysql_query($query_rsTitles, $abe) or die(mysql_error());
$row_rsTitles = mysql_fetch_assoc($rsTitles);
$totalRows_rsTitles = mysql_num_rows($rsTitles);
mysql_select_db($database_abe, $abe);
$query_rs_comments = "SELECT * FROM guest";
$rs_comments = mysql_query($query_rs_comments, $abe) or die(mysql_error());
$row_rs_comments = mysql_fetch_assoc($rs_comments);
$totalRows_rs_comments = mysql_num_rows($rs_comments);
mysql_select_db($database_abe, $abe);
$query_rs_users = "SELECT * FROM users";
$rs_users = mysql_query($query_rs_users, $abe) or die(mysql_error());
$row_rs_users = mysql_fetch_assoc($rs_users);
$totalRows_rs_users = mysql_num_rows($rs_users);
mysql_select_db($database_abe, $abe);
$query_Recordset1 = "SELECT COUNT(guest.software_id) as COUNT, titles.id FROM titles LEFT JOIN guest ON titles.id = guest.software_id GROUP BY titles.id";
$Recordset1 = mysql_query($query_Recordset1) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if(!isset($_POST['softwareLevel'])){
if (!isset($_GET['class_id'])) {
//show all software titles
$query_rsTitles = "SELECT id, title, company, `description`, resources, location, url, image, keyword, copies FROM titles ORDER BY id ASC";
}else{
//show software titles filtered by Literacy of Numeracy (using URL GET variable)
$query_rsTitles = "SELECT id, title, company, `description`, resources, location, url, image, keyword, copies FROM titles WHERE titles.class_id = ". GetSQLValueString($_GET['class_id'], "int") ." ORDER BY id ASC";
}
}else{
//show software titles filtered by Level
$_POST['softwareLevel'][0] = 5000;
$_POST['softwareLevel'][1] = 6000;
$_POST['softwareLevel'][2] = 7000;
$_POST['softwareLevel'][3] = 8000;
$_POST['softwareLevel'][4] = 9000;
$where = '';
# You only need the where clause IF any options have been selected
if (count($_POST['softwareLevel']))
{
# Create an array containing as many elements of 'int' as there are
# elements in $_POST['softwareLevel']
$types = array_pad(array(), count($_POST['softwareLevel']), 'int');
# Use array map to call GetSQLValueString() for each combination of elements
# in these two arrays, i.e. apply GetSQLValueString using 'int' for all of the input data
$_POST['softwareLevel'] = array_map('GetSQLValueString', $_POST['softwareLevel'], $types);
$where = sprintf(' WHERE titles.level_id IN (%s) ',
implode(', ', $_POST['softwareLevel']));
}
$query = sprintf('SELECT id, title, company, `description`, resources, location, url, image, keyword, copies FROM titles %s ORDER BY id ASC', $where);
}
$rsTitles = mysql_query($query_rsTitles, $abe) or die(mysql_error());
$row_rsTitles = mysql_fetch_assoc($rsTitles);
$totalRows_rsTitles = mysql_num_rows($rsTitles);
echo "<pre>get";
var_dump($_GET);
echo "</pre>";
echo "<pre>post";
var_dump($_POST);
echo "</pre>";
$colname_rs_comments = array('this', 'is', 'an array');
echo "First test: ";
echo is_array($colname_rs_comments) ? 'Array' : 'not an Array';
echo "\n<p/>";
$no = 'this is a string';
echo "Second test: ";
echo is_array($no) ? 'Array' : 'not an Array';
echo "\n<p/>";