i'm trying to do this:
function myFunction($id, $id2) {
$cl=$dbh->prepare("SELECT id2 FROM users WHERE id = :id");
$cl->bindParam(':id', $id);
$cl->execute();
$cli=$cl->fetch(PDO::FETCH_ASSOC);
$lid=$cli['id2'];
if($id !== $id2) {
exit("mismatch error");
}
}
then i want to call myFunction on another page.
myFunction($id, $id2);
how can i do this correctly on another page?
let me explain better. here is what im trying to do.
i have been putting this on every page:
$cl=$dbh->prepare("SELECT id2 FROM users WHERE id = :id");
$cl->bindParam(':id', $id);
$cl->execute();
$cli=$cl->fetch(PDO::FETCH_ASSOC);
$lid=$cli['id2'];
if($id !== $id2) {
exit("mismatch error");
}
}
but how would i make that into a function?