Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 检查textarea是否不工作_Php_Mysql - Fatal编程技术网

Php 检查textarea是否不工作

Php 检查textarea是否不工作,php,mysql,Php,Mysql,-我只是想为后用户 -我有两个表(用户、帖子), 我不知道该怎么做 //编码html表单和文本区域 <form method="POST" autocomplete="off" action=""> <textarea name="none" class="textarea" placeholder="Quelle est votre question ?"></textarea>

-我只是想为后用户

-我有两个表(用户、帖子), 我不知道该怎么做 //编码html表单和文本区域

               <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

            ));
         }

菲利埃:阿奎尔
smpc
smia
svt
开关电源
smc
sma
smi
svi
Semestre:Accueil
s1
s2
s3
s4
s5
中六
阿约特
//php代码
$userId=$\u会话['user\u id'];
如果(isset($_POST['ajourner']))
{
$post=$_post['none'];
$stmt=$connect->prepare('插入到
出版物(id_auteur,date_post,post)值(?,NOW(),?)';
$stmt->execute(数组)(
“:id_auteur”=>$userId,
':post'=>$post
));
}

代码。。。致命错误PDO:未捕获PDO异常:SQLSTATE[HY093]:无效参数编号:未使用命名占位符定义参数

$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( :id_auteur, NOW(),:post ) ');

    $stmt->execute(array(
        ':id_auteur' => $userId,
        ':post'      => $post
    ));
$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( ?, NOW(),? ) ');

    $stmt->execute(array(
        1      => $userId,
        2      => $post
    ));
使用
作为占位符

$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( :id_auteur, NOW(),:post ) ');

    $stmt->execute(array(
        ':id_auteur' => $userId,
        ':post'      => $post
    ));
$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( ?, NOW(),? ) ');

    $stmt->execute(array(
        1      => $userId,
        2      => $post
    ));

使用命名的占位符

$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( :id_auteur, NOW(),:post ) ');

    $stmt->execute(array(
        ':id_auteur' => $userId,
        ':post'      => $post
    ));
$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( ?, NOW(),? ) ');

    $stmt->execute(array(
        1      => $userId,
        2      => $post
    ));
使用
作为占位符

$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( :id_auteur, NOW(),:post ) ');

    $stmt->execute(array(
        ':id_auteur' => $userId,
        ':post'      => $post
    ));
$stmt=$connect->prepare('INSERT INTO 
                publications(id_auteur,date_post,post) VALUES( ?, NOW(),? ) ');

    $stmt->execute(array(
        1      => $userId,
        2      => $post
    ));

如果使用
作为占位符,则使用整数作为绑定参数如果使用
作为占位符,则使用整数作为绑定参数