Hi there,

I have a form that collects array values and then posts it to another page.eg

<form action="page2" method="POST">
<input name = "myid[]" type="text" value="1">
<input name = "myid[]" type="text" value="4">
<input name = "myid[]" type="text" value="6">
</form>

the second page then receives the array and implodes the results

$i = $_POST['myid[]'];
$j = implode(",",$i);

i then want the $j to be used to filter a table with the MYSQL IN statement

$col1_items = $j;
mysql_select_db($mydb, $myconnection);
$query_items = sprintf("SELECT * FROM myshop WHERE pkId IN (%s), GetSQLValueString($col1_items, "text"));
$items = mysql_query($query_items, $myconnection) or die(mysql_error());

but for some reason this does not work. Any ideas

Solved this one. The problem was that i used the GetSQLValueString to escape the sql as text. Mysql did not like this. When i changed the statement to not include GetSQLValueString it worked.

$col1_items = $j;
mysql_select_db($mydb, $myconnection);
$query_items = sprintf("SELECT * FROM myshop WHERE pkId IN ($col1_items));
$items = mysql_query($query_items, $myconnection) or die(mysql_error());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.