prepare("SELECT `LinkID`, `ContentID`, `Nickname` FROM `Links` WHERE `LinkID` = ?"); $stmt1->bind_param("s", $idcko); $stmt1->bind_result($linkid, $contentid, $nickname); $stmt1->execute(); $stmt1->store_result(); if ($stmt1->num_rows() < 1) { die("Nonexistent link"); } while ($stmt1->fetch()) { $stmt2 = $mysqli->prepare("SELECT `Content` FROM Content WHERE `ContentID` = ?"); $stmt2->bind_param("s", $contentid); $stmt2->bind_result ($content); $stmt2->execute(); $stmt2->store_result(); if ($stmt2->num_rows() < 1) { die("Faulty link"); } while ($stmt2->fetch()) { $action = "Success"; $stmt3 = $mysqli->prepare("INSERT INTO Logs (`Action`, `LinkID`, `ContentID`, `Datetime`, `Nickname`, `IP`) VALUES (?, ?, ?, ?, ?, ?);"); $stmt3->bind_param('ssssss', $action, $idcko, $contentid, $curdate, $nickname, $ipcka); $stmt3->execute(); $stmt3->store_result(); echo $content; } } } else{ die("No link"); } ?>