简体   繁体   English

致命错误mysql PHP

[英]fatal error mysql php

I am trying to use php to insert data into my mysql database. 我正在尝试使用php将数据插入到我的mysql数据库中。 When i do this, i get the error message : Catchable fatal error: Object of class mysqli_result could not be converted to string in order_handle.php on line 145. 当我这样做时,我收到错误消息:可捕获的致命错误:mysqli_result类的对象无法在145行的order_handle.php中转换为字符串。

Here is line 144-152; 这是144-152行;

$payment_date = $year."-".$month_number."-".$day;
$insert_ho = "insert into shirt_orders (order_total, payment_date, shirt_credit_cards_id, shirt_shipping_addresses_id, shirt_billing_addresses_id, shirt_shipping_methods_id) values ('$order_total', '$payment_date', '$shirt_credit_cards_id', '$shirt_shipping_addresses_id', '$shirt_billing_addresses_id', '$shirt_shipping_methods_id')";
$exec_insert_ho = @mysqli_query($link, $insert_ho);
if (!$exec_insert_ho) {
    rollback_die("The insertion into shirt_orders was unsuccessful because: ".mysqli_error($link));
} else {
    $shirt_orders_id = mysqli_insert_id($link);
    $insert_gut = "insert into shirt_users_types (shirt_users_id, shirt_orders_id, type_quantity, type_total) values ($shirt_users_id, '$shirt_orders_id', '$qty', '$order_total')";
    $exec_insert_gut = @mysqli_query($link, $insert_gut);

Im not quite sure what the error is for. 我不太确定错误的原因。 I have reviewed several other questions on the site similar to this but none really have addressed anything similar. 我已经在网站上复查了与此类似的其他几个问题,但没有一个确实解决了类似的问题。 any help would be great! 任何帮助将是巨大的!

I think the error is in the data. 我认为错误在于数据中。 Do you have an example of the data that triggers the error? 您是否有触发错误的数据示例? What happens if you run the query in mysql client? 如果在mysql客户端中运行查询会怎样?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM