-2

これは私には意味がないようです。これは実際に間違っていますか?私は他の人の作品を見てきましたが、次の例のように、私と同じタイプの bind_param を持っています。

php, mysqli-stmt.bind-param]: 型定義文字列の要素数がバインド変数の数と一致しません

ここには 23 個の値と 23 個の値があります (はい、個別に数えました。念のため、dreamweaver で Enter キーを押しました)。安全のために、46 で試してみました。

$stmt= $con->prepare("INSERT INTO form_corpo_test (compagnie, telephone, site_web, texte_fr, texte_en, categories, profil_exposant, stands_du_manufacturier, pourcentage_quebec, pourcentage_canada, pourcentage_usa, pourcentage_autre, exporte, exporte_souhaite, produits_vert, nouveau_produits, nom, courriel, telephone_ressource, personne_ressource_c_toi, autre_personne_ressource, autre_courriel, autre_telephone)
VALUES
('$_POST[company]','$_POST[phone]','$_POST[website]','$_POST[messagefr]','$_POST[messageen]','$str','$_POST[profession]','$_POST[manufacturiers_stand]','$_POST[percent_quebec]','$_POST[percent_canada]','$_POST[percent_usa]','$_POST[percent_autre]','$_POST[bt_export]','$_POST[bt_export_souhaite]','$_POST[bt_prod_verts]','$_POST[bt_new_prod]','$_POST[name]','$_POST[email]','$_POST[resource_phone]','$_POST[personne_ressource]','$_POST[backup_name]','$_POST[backup_email]','$_POST[backup_phone]')");



$stmt->bind_param("sssssssssssssssssssssss", $compagnie, $telephone, $site_web, $texte_fr, $texte_en, $categories, $profil_exposant, $stands_du_manufacturier, $pourcentage_quebec, $pourcentage_canada, $pourcentage_usa, $pourcentage_autre, $exporte, $exporte_souhaite, $produits_vert, $nouveau_produits, $nom, $courriel, $telephone_ressource, $personne_ressource_c_toi, $autre_personne_ressource, $autre_courriel, $autre_telephone);

そして、これを試しました(電話番号は整数であるため)

sissssssiiiissssssisssi

どちらもこのエラーを出力します:

警告: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: 変数の数が /home/product/public_html/sidim.com/formulaires/processForm-test.php の準備されたステートメントのパラメーターの数と一致しません77行目

編集3

私は現時点でこれを持っています: $con->query("INSERT INTO form_corpo_test SELECT * FROM *");

$stmt = $con->prepare("INSERT INTO form_corpo_test VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

$stmt->bind_param('sissssssiiiissssssisssi', $compagnie, $telephone, $site_web, $texte_fr, $texte_en, $categories, $profil_exposant, $stands_du_manufacturier, $pourcentage_quebec, $pourcentage_canada, $pourcentage_usa, $pourcentage_autre, $exporte, $exporte_souhaite, $produits_vert, $nouveau_produits, $nom, $courriel, $telephone_ressource, $personne_ressource_c_toi, $autre_personne_ressource, $autre_courriel, $autre_telephone);   // bind $compagnie etc. to the parameter

これはまだこの出力にエラーがあります

致命的なエラー: 83 行目の /home/product/public_html/*****/********/processForm-test.php の非オブジェクトに対するメンバー関数 bind_param() の呼び出し

これは次のことを指します。

$stmt->bind_param('sissssssiiiissssssisssi', $compagnie, $telephone, $site_web, $texte_fr, $texte_en, $categories, $profil_exposant, $stands_du_manufacturier, $pourcentage_quebec, $pourcentage_canada, $pourcentage_usa, $pourcentage_autre, $exporte, $exporte_souhaite, $produits_vert, $nouveau_produits, $nom, $courriel, $telephone_ressource, $personne_ressource_c_toi, $autre_personne_ressource, $autre_courriel, $autre_telephone);   // bind $compagnie etc. to the parameter

これまでに何か問題がある場合は、ぜひお知らせください。u_mulder の投稿を詳しく調べてみます。

4

1 に答える 1

0

PHPマニュアルでは、パラメータをバインドする方法が示されています:

$stmt = mysqli_prepare($link, "INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, 'sssd', $code, $language, $official, $percent);

クエスチョンマークが見えますか?すべての疑問符は、 のパラメータに置き換えられますbind_param。したがって、クエリは次のようになります。

$stmt= $con->prepare("INSERT INTO form_corpo_test (compagnie,... autre_telephone) VALUES (?, ?, ?, ?, ?, ?, ?, ....."); // 26 ?-signs
$stmt->bind_param("sssssssssssssssssssssss", $compagnie, $telephone.. ); // your params here
于 2013-09-17T20:50:05.590 に答える