我发现了类似的查询,如我的计算器,但没有找到解决方案。所以我又问了一遍。我有以下insert
查询:可捕捉的致命错误:类stdClass的对象无法转换为字符串时试图插入到数据库
$purchase_date = date("Y-m-d");
$init = substr($info[fname], 0, 2);
$odr = rand(0,255);
$invoice_number = $this->get_invoice_number();
//$invoice_number = $invoice_number+1;
//$invoice_number = 400 + rand(0,100);
$order_number = $init.'-'.$odr;
$session_id = session_id();
$sql = "
INSERT INTO
tbl_checkout
SET
fname = '$info[fname]',
lname = '$info[lname]',
email = '$info[email]',
phone = '$info[phone]',
address = '$info[address]',
pin = '$info[pin]',
session_id = '$session_id',
purchase_date = '$purchase_date',
invoice_number = '$invoice_number',
order_number = '$order_number' <----This is line no 1038
";
$this->db->insertQuery($sql);
但是,当我试图执行它,它显示错误,如Catchable fatal error: Object of class stdClass could not be converted to string in c:\.....on line 1038
我迷路了,因为我甚至无法理解的错误意味着!请帮忙。
雅...非常感谢。愚弄我,这是一个对象! – AssamGuy 2012-02-01 10:35:07
当然,它是铸造到首先导致错误的字符串... – cmbuckley 2012-02-01 10:35:56