I need to create an array and then run it against values in my db table to see if I get any results in the database corresponding to the values in my array. Also I would like to store that array in another table for the same user to run the query next time.
Having difficulties figuring all this out. Arrays historically cause me a headache...
I have the following snippet from elesewhere, it looks like I could do something very similar, right?
if ($_POST['tID']) {
$ser_tID = serialize($_POST['tID']);
$_SESSION['ser_tID'] = $ser_tID;
}
$unser_tID = unserialize($_SESSION['ser_tID']);
if (!get_magic_quotes_gpc()) {
foreach($unser_tID as $key => $value) {
${$key} = addslashes($value);
}
} else {
foreach($unser_tID as $key => $value) {
${$key} = addslashes($value);
}
}
$in = array();
foreach ($unser_tID as $box) $in[] = $box;
$in = implode(',', $in);
$query = "SELECT * FROM t1 WHERE toc_id IN ( $in )";
$my_matches = $db->get_results($query);
foreach ($my_matches as $match) {
// get my matches
}
Am I being realistic here?