mysqli_stmt_bind_param变量类型 [英] mysqli_stmt_bind_param variable type

查看:608
本文介绍了mysqli_stmt_bind_param变量类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从mysql_转换为mysqli_,但仍然是mysqli_的新手.这是我的代码:

I'm converting from mysql_ to mysqli_ and still new to mysqli_. Here is my code:

$stmt = mysqli_prepare($con, "INSERT INTO test VALUES (?, ?)");
mysqli_stmt_bind_param($stmt, 'ss', $a, $b);

$a=1;
$b=1.5;


mysqli_stmt_execute($stmt);

我的问题是:

$a has Integer value
$b float

,但mysqli_stmt_bind_param ss (string,string)中对应的变量类型.

but the corresponding variable type in mysqli_stmt_bind_param ss (string,string).

结果是数据成功插入到表中,是否按预期工作或我做错了?

the result is data succesfuly inserted to table, is work as intended or i'm doing wrong?

推荐答案

实际上的绑定函数(mysqli_stmt_bind_paramPDOStatement::bindParam)不是验证函数.您将展示如何仅解释自己的价值,以及想要从结果中获得什么样的价值.

Actually bind functions (mysqli_stmt_bind_param or PDOStatement::bindParam) are not validation functions. You show how to interpret your value only and what type of value you want to get from result.

答案是:它按预期工作.

这篇关于mysqli_stmt_bind_param变量类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆