I have the following command in a block of php code:
header("Location: clivesclassiclounge_blogtest_single.php?loginsuccess");
I would like to modify the header to query a database – something like:
header("Location: clivesclassiclounge_blogtest_single.php?post=<?php echo $row['id']?>loginsuccess");
My coding program/text editor detects an error when I try to set this up (also it just feels sloppy). I feel like I am coming at this problem the wrong way at would really appreciate any advice.
Thanks,
Full code block:
function getLogin ($conn) {
    if (isset($_POST['loginSubmit'])) {
    $uid= mysqli_real_escape_string($conn, $_POST['uid']);
    $pwd= mysqli_real_escape_string($conn, $_POST['pwd']);
    $sql = "SELECT * FROM user WHERE uid='$uid' AND pwd='$pwd'";
    $result = mysqli_query($conn, $sql);
    if (mysqli_num_rows($result) > 0) {
        if ($row = $result->fetch_assoc()) {
            $_SESSION['id'] = $row['id'];
            $_SESSION['uid'] = $row['uid'];
            header("Location: clivesclassiclounge_blogtest_single.php?loginsuccess");
            exit();
        }
    } else {
        header("Location: clivesclassiclounge_blogtest_single.php?loginfailed");
        exit();
        }
    }
}
 
     
    