Estoy tratando d conectarme a la base d datos del CMS d ecommerce llamado 'opencart' por medio d las nueva herramienta q trae el flex builder 4 (tipo amfp o weborb). La conexion se hizo exitosamente, pero... me esta generando varios errores al empezar a pedir datos a la base d datos (valga la redundancia) en una sola tabla, con las demas me funciona perfecto.
La tabla tiene 51 columnas.
Creen q el problema sea la cantidad d columnas?
Este es el error q tengo:
Código :
InvocationTargetException:There was an error while invoking the operation. Check your server settings and try invoking the operation again. Reason: Server error MySQL Error - 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order where order_id=?' at line 1 #0 C:\wamp\www\opencart\pruebaopencart\services\OrderService.php(93): OrderService->throwExceptionOnError() #1 [internal function]: OrderService->getOrderByID(1) #2 [internal function]: ReflectionMethod->invokeArgs(Object(OrderService), Array) #3 C:\wamp\www\ZendFramework\library\Zend\Server\Reflection\Function\Abstract.php(368): call_user_func_array(Array, Array) #4 [internal function]: Zend_Server_Reflection_Function_Abstract->__call('invokeArgs', Array) #5 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(356): Zend_Server_Reflection_Method->invokeArgs(Object(OrderService), Array) #6 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(550): Zend_Amf_Server->_dispatch('getOrderByID', Array, 'OrderService') #7 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(626): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http)) #8 C:\wamp\www\opencart\pruebaopencart\gateway.php(69): Zend_Amf_Server->handle() #9 {main}
Asi se hace la llamada autogenerada por flex:
Código :
public function getOrderByID($itemID) { $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where order_id=?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, $itemID); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_bind_result($stmt, $row->order_id, $row->invoice_id, $row->invoice_prefix, $row->store_id, $row->store_name, $row->store_url, $row->customer_id, $row->customer_group_id, $row->firstname, $row->lastname, $row->telephone, $row->fax, $row->email, $row->shipping_firstname, $row->shipping_lastname, $row->shipping_company, $row->shipping_address_1, $row->shipping_address_2, $row->shipping_city, $row->shipping_postcode, $row->shipping_zone, $row->shipping_zone_id, $row->shipping_country, $row->shipping_country_id, $row->shipping_address_format, $row->shipping_method, $row->payment_firstname, $row->payment_lastname, $row->payment_company, $row->payment_address_1, $row->payment_address_2, $row->payment_city, $row->payment_postcode, $row->payment_zone, $row->payment_zone_id, $row->payment_country, $row->payment_country_id, $row->payment_address_format, $row->payment_method, $row->comment, $row->total, $row->order_status_id, $row->language_id, $row->currency_id, $row->currency, $row->value, $row->coupon_id, $row->date_modified, $row->date_added, $row->ip); if(mysqli_stmt_fetch($stmt)) { $row->date_modified = new DateTime($row->date_modified); $row->date_added = new DateTime($row->date_added); return $row; } else { return null; } }
Esta es la funciona para los errores (solo por si pregunta d donde salio: 'throwExceptionOnError();')
Código :
private function throwExceptionOnError($link = null) { if($link == null) { $link = $this->connection; } if(mysqli_error($link)) { $msg = mysqli_errno($link) . ": " . mysqli_error($link); throw new Exception('MySQL Error - '. $msg); } }
La sintaxis d sql ya la verifique y todo esta bien (segun yo ).
Saludos y muchas gracias.