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">

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

6 Years
Discussion Span
Last Post by opticblaze

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());
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.