-我只想找一个post用户
-我有两个表(users,post),我不知道makesystempost//编码html表单和textarea
<form method="POST" autocomplete="off" action="">
<textarea name="none" class="textarea" placeholder="Quelle est votre question ?"></textarea>
<select>
<option value="filiére" selected="1">Filiére : Accueil</option>
<option value="smp">smpc</option>
<option value="smp">smia</option>
<option value="smp">svt</option>
<option value="smp">smp</option>
<option value="smp">smc</option>
<option value="smp">sma</option>
<option value="smp">smi</option>
<option value="smp">svi</option>
</select>
<select>
<option value="accueil" selected="1">Semestre : Accueil</option>
<option value="s1">s1</option>
<option value="s2">s2</option>
<option value="s3">s3</option>
<option value="s4">s4</option>
<option value="s5">s5</option>
<option value="s6">s6</option>
</select>
<button class="btn-ajouter" type="submit" name="ajouter" value="ajouter">ajouter</button>
</form>
//code php
$userId = $_SESSION['user_id'];
if(isset($_POST['ajouter']))
{
$post = $_POST['none'];
$stmt=$connect->prepare('INSERT INTO
publications(id_auteur,date_post,post) VALUES(?,NOW(),?) ');
$stmt->execute(array(
':id_auteur' => $userId,
':post' => $post
));
}
代码。。。致命错误pdo:未捕获的pdoexception:sqlstate[hy093]:无效的参数号:未定义参数
1条答案
按热度按时间fumotvh31#
使用命名占位符
与
?
作为占位符