Hi! i have a search form where the user can copy and paste a list of values (one per line) and i would want to search each of those against the mysql database and return the result.
using the below code, i am able to read through each line of the input but i am getting the result for only the last line of input.
any help would be appreciated.
thanks
$pieces=$_POST["search"];
$array = explode("\n", $pieces);
$today = date('l jS F Y');
foreach($array as $arrayid){
$result = mysql_query("SELECT array.array_id, num, 1week, 6week, 10week FROM array LEFT JOIN array2 USING (array_id) WHERE array.array_id LIKE '%$arrayid%'");
$r=mysql_fetch_array($result);
$id=$r["array_id"];
$num=$r["num"];
$ten=$r["10week"];
$one=$r["1week"];
$six=$r["6week"];
//display the row
echo "Array ID: $id <br>num: $num <br> 10Week: $ten <br> 1Week: $one <br> 6Week: $six <br> ";
echo "<br>---------------------------------------------<br>";
}
using the below code, i am able to read through each line of the input but i am getting the result for only the last line of input.
any help would be appreciated.
thanks
$pieces=$_POST["search"];
$array = explode("\n", $pieces);
$today = date('l jS F Y');
foreach($array as $arrayid){
$result = mysql_query("SELECT array.array_id, num, 1week, 6week, 10week FROM array LEFT JOIN array2 USING (array_id) WHERE array.array_id LIKE '%$arrayid%'");
$r=mysql_fetch_array($result);
$id=$r["array_id"];
$num=$r["num"];
$ten=$r["10week"];
$one=$r["1week"];
$six=$r["6week"];
//display the row
echo "Array ID: $id <br>num: $num <br> 10Week: $ten <br> 1Week: $one <br> 6Week: $six <br> ";
echo "<br>---------------------------------------------<br>";
}