Name of user in question

This commit is contained in:
posweg 2020-05-21 09:04:09 +00:00
parent 9247804208
commit 30bc7ac4dc
1 changed files with 4 additions and 5 deletions

View File

@ -6,10 +6,6 @@ if(!$user || !$user["id"]){
include("404.php");
die();
}
//else if(!$user["id"]){
// include("404.php");
// die();
//}
$db->exec("CREATE TABLE IF NOT EXISTS questions(
id INTEGER PRIMARY KEY,
@ -60,9 +56,12 @@ if(isset($_POST["post-submit"])){
</form>
<?php
$u_prep = $db->prepare("SELECT * FROM users WHERE id = :id");
$qs = $db->query("SELECT * FROM questions WHERE user = '" . $user["id"] . "' LIMIT 0, 10;");
while($current = $qs->fetchArray(SQLITE3_ASSOC)){
echo("<h3>". $current["by"] ."</h3>");
$u_prep->bindValue(":id", $current["by"], SQLITE3_INTEGER);
$q_user = $u_prep->execute()->fetchArray(SQLITE3_ASSOC);
echo("<h3>". $q_user["name"] ."</h3>");
echo("<p>". $current["question"] ."<p>");
}
?>