$userid = $_SESSION['userid']; $usern = $_SESSION['username']; $userrank = $_SESSION['rank']; $pdo = new PDO('mysql:host=localhost;dbname=localdb', 'root', ''); if(isset($_GET['adda'])) { $error=false; $title=$_POST['title']; $lnk=$_POST['lnk']; $descr=$_POST['descr']; $alat=$_POST['alat']; $alng=$_POST['alng']; $statement = $pdo->prepare("INSERT INTO activity('title', 'link', 'description', 'alat', 'alng', 'fromname', 'fromid') VALUES (:title, :lnk, :descr, :alat, :alng, :usern, :userid) "); $result = $statement->execute(array('title' => $title, 'link' => $lnk, 'description' => $descr, 'alat' => $alat, 'alng' => $alng, 'fromname' => $usern, 'fromid' => $userid)); }
The
$statement
works fine in my register.php but here it doesnt work!
I get this error message:
PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\xampp\htdocs\activity.php on line 12
I cant find the mistake. Thanks for youre help! :)