[Solved] PHP: Passing row values into form to edit


You’re mixing named parameters with variables. You are also not binding the variable to the query. Since you’re not using raw PDO, it will obviously vary a little bit, but here’s what you would do if you were. You’ll just have to adapt it to your $event object:

$stmt = $dbh->prepare(
    "SELECT 
        event_name, 
        event_description, 
        event_category, 
        event_date,
        event_venue, 
        event_location 
    FROM 
        events 
    WHERE
        event_id=:eventid"
);
$stmt->execute(['eventid' => $eventid]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);

Note: Cutting long lines short is also recommended.

solved PHP: Passing row values into form to edit