iDentity iDentity - 4 years ago 87
HTML Question

Button to update MySQL column not working

I want to update my database with an SQL statement once someone clicks a button on the website. I've tried something, no success. Can you guys help me ? Here's the code:

Don't know if I made this question correctly, I'm new here.

Answer Source

Your prepared statement is wrong.

The code I use with pdo to do a query is this:

$sqlUpd = $upd->prepare("UPDATE league_signups SET approved='1' WHERE id = :id");
$q->bindParam(':id', $id, PDO::PARAM_STR);

Should work like a charm.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download