语法错误:以下代码的第5行中出现意外的T_String错误。

时间:2016-04-23 04:56:29

标签: php

<?php

$db_name=“a7614252_booked”;
$mysql_user="a7614252_booked”;
$mysql_pass=“booked”;
$server_name="server38.000webhost.com”; //t_string error here. 

$con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name)or   die(‘Connection Error’.mysqli_connect_error());

?>

我已经检查了同一错误的其他回复,但这似乎都不是问题的答案。谢谢。

2 个答案:

答案 0 :(得分:0)

使用此代码,将function send_order($order,$wcustid,$customer_address_id) { // function to call $this->load->model("order_product_m"); $msg=''; $order_ref = $order[0]->order_no; $payment_method='payment'; $currency='currency'; $currency_rate='1.00'; //get shippingn method $shipping=$this->order_m->getShippingMethod($order[0]->shipping_id); $ship_method = 'Delivered'; $ship_amount = $shipping[0]->amount; $addOrderHeaderToWarehouse = $this->BLWP_CreateOrderHeader($wcustid, $customer_address_id, $order_ref, $ship_method,$ship_amount,$payment_method, $currency, $currency_rate); $status_ord_header = explode("=", $addOrderHeaderToWarehouse[1]); if(strpos($addOrderHeaderToWarehouse[1], 'OK')== true) { $ord = explode("=", $addOrderHeaderToWarehouse[3]); $warehouseOredrId=$ord[1]; $w_ordid=(int)$warehouseOredrId; $this->order_m->addWwarehouseorder($order[0]->id,$warehouseOredrId); //update order with warehouse id //update table orders with warehouse order id //SAVE WAREHOUSE ORDER ID FOR CRM ORDERS $order_products=$this->order_m->getOrderProducts($order[0]->id); $orderlineitem=0; foreach($order_products as $order_product) { //get warehouse order id from local db $w_ord_id=$this->order_m->getwarehouseOrderId($order_product->order_id); $prod=$this->product_m->getProductCode($order_product->product_id); $product_code = $prod[0]->product_code; $addorderproduct = $this->BLWP_CreateOrderLine($w_ord_id[0]->warehouse_order_id, $product_code, $order_product->quantity, $order_product->sales_price,''); if(strpos($addorderproduct[1], 'OK')== true) { $ordline = explode("=", $addorderproduct[3]); $w_order_line_id=$ordline[1]; //add order line id for each product in the table order product $this->order_product_m->update_order_line_id($order_product->order_id,$order_product->product_id,$w_order_line_id); $orderlineitem=1; } else $msg="Order line item not created"; } //Process order================================ if($orderlineitem==1) { $process_ord_response = $this->BLWP_ProcessOrder($w_ordid); $process_order = explode("=", $process_ord_response[3]); $w_ord_status= $process_order[1]; $this->order_m->addWarehouseorderStatus($order[0]->id,$w_ord_status); //update order with warehouse id/ } else $msg.="<br>Order not processed"; //============================================ $msg.=" Order sent to warehouse"; } else { $msg="Order could not be sent to warehouse"; $this->send_order($order,$wcustid,$customer_address_id); //want to create the retry button here. } return $msg; } 替换为"

'

答案 1 :(得分:0)

你需要用替换"的所有出现以及反引号 ` '。否则PHP会将后者解释为bash命令。

$db_name="a7614252_booked";
$mysql_user="a7614252_booked";
$mysql_pass="booked";
$server_name="server38.000webhost.com"; //t_string error here. 
$con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name)or   die('Connection Error'.mysqli_connect_error());