$order = new Application_Model_Dbtable_Order();$orderno = $order->select()->from($order,'orderno')->where('memberID = ?',$userID)->order('orderno DESC')->limit(1,0);
sqlSTATE[HY000]: General error: 1366 Incorrect integer value: ‘SELECT
ordertable
.orderno
FROMordertable
WHERE (memberID = ’30’) ORDER BYorderno
DESC liMIT 1′ for column ‘orderno’ at row 1
得到了这个错误,我想知道我的代码是否有任何问题,因为我已经到处搜索原因,但似乎没有找到任何帮助.
#sql code for Ordertable#`orderno` int(5) NOT NulL auto_INCREMENT,`memberID` int(5) DEFAulT NulL,PRIMARY KEY (`orderno`)#sql code for Item#`itemID` int(5) NOT NulL auto_INCREMENT,`image` varchar(100) NOT NulL,`itemname` varchar(30) DEFAulT NulL,`description` varchar(100) DEFAulT NulL,`itemtype` varchar(20) DEFAulT NulL,PRIMARY KEY (`itemID`)#sql code for Orderdetail#`orderdetailno` int(5) NOT NulL auto_INCREMENT,`orderno` int(5) NOT NulL,`itemID` int(5) NOT NulL,`unitcost` decimal(6,2) DEFAulT NulL,PRIMARY KEY (`orderdetailno`),KEY `orderno` (`orderno`),KEY `itemID` (`itemID`)
这是我的sql代码,如果它有助于我使用MysqL.
$request = new Zend_Session_namespace('cart');$auth = Zend_Auth::getInstance();$user = $auth->getIDentity();$userID = $user->userID;$order = new Application_Model_Dbtable_Order();$itemdb = new Application_Model_Dbtable_Item();$orderdetail = new Application_Model_Dbtable_Orderdetail();$data = array ('memberID' => $userID);$order->insert($data);$orderno = $order->select()->from($order,0);foreach ($request->array as $var){$unitprice = $itemdb->select()->from('$itemdb','unitcost')->where('itemID = ?',$var);$newArray = array('orderno' => $orderno,'itemID' => $var,'unitcost' => $unitprice,);$orderdetail->insert($newArray); }
任何指导将非常感谢.最佳答案每https://stackoverflow.com/a/8882396/1432614,运行
SELECT @@GLOBAL.sql_mode;SELECT @@SESSION.sql_mode;
如果要么包含STRICT_TRANS_tableS,请将其从设置中删除.
例如:
SET @@GLOBAL.sql_mode= 'NO_auto_CREATE_USER,NO_ENGINE_SUBSTITUTION';
总结 以上是内存溢出为你收集整理的mysql – SQLSTATE [HY000]:常规错误:1366不正确的整数值:全部内容,希望文章能够帮你解决mysql – SQLSTATE [HY000]:常规错误:1366不正确的整数值:所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)