网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > ZenCart
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 112.87.6.199
Old 2016-05-04, 05:58 AM
Natalya Natalya is offline
初级会员
 
Join Date: 2006-01-24
Posts: 1
Natalya 现在声名狼藉
Default zencart数据库类函数bindVars()

zen cart mysql queryFactory类函数function bindVars($sql, $bindVarString, $bindVarValue, $bindVarType, $debug = false)主要就是把SQL语句里面的一些特定字符串绑定到所设置的变量里面。
比如某个sql查询语句里面有这样的一段 and pd.language_id = :languagesID 。其中:languagesID就是特定的字符串,而调用
$db->bindVars($featured_products_query_raw, ‘:languagesID’, $_SESSION['languages_id'], ‘integer’); 这个就是把:languagesID 替换为$_SESSION['languages_id'],而这个替换的值是integer类型,也就是int数据类型。其实可以不需要该函数也可以直接使用这样的语句and pd.language_id =(int)$_SESSION['languages_id'],对于不是很复杂的sql语句可以这样使用,但是对于一些查询语句比较复杂的,为了不出错,还是建议把需要使用的变量先使用( :变量标识符)这种方式写入sql语句,然后再使用bindVars函数将该字符串替换为需要设置的变量
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:07 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.