简体   繁体   English

我在将数据从索引转换为进程时出错“无法将mysqli_result类的对象转换为int形式”

[英]I got error to casting data from index to process “Object of class mysqli_result could not be converted to int in”

i got error casting in calculation square distance 我在计算平方距离时出错

i have to make simple sql program but i got problem in casting data 我必须制作简单的sql程序,但是在转换数据时遇到问题

 if (isset($_POST['hitung'])) { $sql = "select * from tb_keterangan"; $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $d_modal =$conn->query("select modal from tb_keterangan"); $d_lahan =$conn->query("select lahan from tb_keterangan"); $d_indukan =$conn->query("select jumlah_indukan from tb_keterangan"); $d_produksi =$conn->query("select jumlah_produksi from tb_keterangan"); $d_keterangan =$conn->query("select keterangan from tb_keterangan"); $modal =$_POST['modal']; $lahan =$_POST['lahan']; $indukan =$_POST['j_indukan']; $produksi =$_POST['produksi']; $ket =$_POST['keterangan']; $h_modal =($d_modal - (int)$row['modal']); $h_lahan =((int)$d_lahan - (int)$lahan); $h_indukan =((int)$d_indukan - (int)$indukan); $h_produksi =((int)$d_produksi - (int)$produksi); // $h_ket =($d_keterangan - $ket); //pangkat $p_modal =pow($h_modal,2); $p_lahan =pow($h_lahan,2); $p_indukan =pow($h_indukan,2); $p_produksi =pow($h_produksi,2); // $p_ket =pow($h_ket,2); $square_distance = $p_modal+$p_lahan+$p_indukan+$p_produksi; ?> 

在此处输入图片说明

but the result calculation is appear 但是出现结果计算

'$d_modal =$conn->query("select modal from tb_keterangan"); '$ d_modal = $ conn-> query(“从tb_keterangan中选择模式”);

These are query variable which you are converting into (int) but you need to get the result from these variables as they are object returned by mysqli query. 这些是要转换为(int)的查询变量,但是您需要从这些变量中获取结果,因为它们是mysqli查询返回的对象。

Use mysqli_fetch functions and then convert it into int 使用mysqli_fetch函数,然后将其转换为int

暂无
暂无

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

相关问题 无法将mysqli_result类的错误对象转换为int - Error Object of class mysqli_result could not be converted to int mysqli_result 类的对象无法转换为 int - Object of class mysqli_result could not be converted to int 注意:mysqli_result类的对象无法转换为int - Notice: Object of class mysqli_result could not be converted to int mysqli_result类的对象无法转换为int-PHP - Object of class mysqli_result could not be converted to int - php 获取错误无法将类mysqli_result的对象转换为字符串 - Getting error Object of class mysqli_result could not be converted to string 未捕获的错误:无法将 mysqli_result 的 class 的 Object 转换为字符串 - Uncaught Error: Object of class mysqli_result could not be converted to string 注意:类 mysqli_result 的对象无法转换为 int 和警告:mysqli_num_rows() 期望参数 1 为 mysqli_result, boolean - Notice: Object of class mysqli_result could not be converted to int and Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean 我如何解决此错误“可捕获的致命错误:mysqli_result类的对象无法转换为字符串”? - how do i solve this error “ Catchable fatal error: Object of class mysqli_result could not be converted to string”? 数据插入-可捕获的致命错误:mysqli_result类的对象无法转换为字符串 - Data insertion - Catchable fatal error: Object of class mysqli_result could not be converted to string 可捕获的致命错误:无法将类mysqli_result的对象转换为字符串i - Catchable fatal error: Object of class mysqli_result could not be converted to string i
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM