简体   繁体   English

类型定义字符串中的元素数与绑定变量数不匹配

[英]Number of elements in type definition string doesn't match number of bind variables

I keep getting this error in my php file .. Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: Number of elements in type definition string doesn't match number of bind variables in ... on line 17 Heres is my code - I am trying to read everything from this table and store each column such as the username, or obo into an array, could be one whole array, or indiviudal ones for each Thanks 我一直在我的PHP文件中收到此错误。.警告:mysqli_stmt_bind_param()[function.mysqli-stmt-bind-param]:类型定义字符串中的元素数量与...在第17行上的绑定变量数量不匹配这是我的代码-我正在尝试从该表中读取所有内容,并将每列(例如用户名或obo)存储到一个数组中,每个数组可能是一个完整的数组,也可能是单个的数组

<?php
    $con = mysqli_connect("*****", "****", "***", "***");

    $username = $_POST["username"];
    $title = $_POST["title"];
    $description = $_POST["description"];
    $location = $_POST["location"];
    $cost = $_POST["cost"];
    $obo = $_POST["obo"];
    $dimmension = $_POST["dimmension"];
    $phone = $_POST["phone"];
    $email = $_POST["email"];
    $image = $_POST["image"];
    $image2 = $_POST["image2"];

    $statement = mysqli_prepare($con, "SELECT username,title,description,location,cost,obo,dimmension,phone,email,image,image2 FROM Postings");
    mysqli_stmt_bind_param($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2);
    mysqli_stmt_execute($statement);

    mysqli_stmt_store_result($statement);
    mysqli_stmt_bind_result($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2);

    $response = array();

    while(mysqli_stmt_fetch($statement)){  
        $response[] = $username;
    }

    $response["success"] = true; 
    #echo json_encode($respond);
    echo json_encode($response);
?>

Heres a picture of my php my admin table 这是我的php我的管理表的图片

在此处输入图片说明

You are calling Select statement and not binding anything. 您正在调用Select语句,但未绑定任何内容。 Remove this line 删除此行

mysqli_stmt_bind_param($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2);

and code will work properly. 并且代码将正常工作。 Good luck. 祝好运。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 bind_param 错误 - 类型定义字符串中的元素数与绑定变量数不匹配 - bind_param error - Number of elements in type definition string doesn't match number of bind variables bind_param()的Mysqli错误:类型定义字符串中的元素数量与绑定变量的数量不匹配 - Mysqli error with bind_param(): Number of elements in type definition string doesn't match number of bind variables Mysqli问题:类型定义字符串中的元素数量与绑定变量的数量不匹配 - Mysqli Problem: Number of elements in type definition string doesn't match number of bind variables mysqli_stmt :: bind_param():类型定义字符串中的元素数量与使用数组的绑定变量数量不匹配 - mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables using array SQL错误:mysqli_stmt :: bind_param():类型定义字符串中的元素数量与绑定变量的数量不匹配 - SQL error :mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables 警告:mysqli_stmt::bind_param():类型定义字符串中的元素数与绑定变量数不匹配 - Warning : mysqli_stmt::bind_param(): Number of elements in type definition string doesn’t match number of bind variables 错误:mysqli_stmt::bind_param():类型定义字符串中的元素数与绑定变量数不匹配 - Error: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables mysqli_stmt :: bind_param():类型定义字符串中的元素数量与绑定变量数量不匹配 - mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables warning 警告:mysqli_stmt_bind_param():类型定义字符串中的元素数与中的绑定变量数不匹配 - Warning: mysqli_stmt_bind_param(): Number of elements in type definition string doesn't match number of bind variables in php, mysqli-stmt.bind-param]:类型定义字符串中的元素数与绑定变量数不匹配 - php, mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM