Hi I have some records as the below format , i want to insert value into database from address bar
127.0.0.1/BetaProject/index.php/Robot/Update?data=<?xml version="1.0" encoding="utf-8"?><DataManage><RobotTime>2012-03-01</RobotTime><RobotModel>Y123</RobotModel><RobotStation>Station1</RobotStation><RobotVer>1.0</RobotVer></DataManage>
This is my controller
class RobotController extends Controller{
public function actionUpdate($data=''){
$Robot = new robotAction();
$xmlcode = simplexml_load_string(trim($data));
$xmlresult = $xmlcode->xpath("//DataManage");
$result=$Robot->Update($xmlresult);
return $result;
}
}
?>
This is my model
<?php if (! defined ('YII_PATH')) exit ('No direct script access allowed');
define("MainDB","robotDB");
class robotAction{
public function Update($xmlData){
$mysql = new RobotMYSQL();
$sqlstr="INSERT INTO ".MainDB.".robot(
RobotTime,
RobotModel,
RobotStation,
RobotVer) VALUES ($xmlData)";
$result = $mysql->MyExcute(MainDB, $sqlstr);
return $result ;
}
}
?>
But I get error of:
PHP notice
Array to string conversion
Please advice