How to get database details is views in opencart

自古美人都是妖i 提交于 2019-12-13 09:46:24

问题


I am writing query in view tpl but i don't know how to get database details and execute that query in views in opencart.Here is my code

$query=mysql_query("select $prefixorder from opencart ");

回答1:


why bothering your self with writing queries using native functions, open cart provides some stuff for you

  • First, read this article, it's great and helped me a lot Here
  • You can now execute the query through
    $result = $this->db->query("write your query here");
    You can get the number of returned rows through $result->num_rows, you can access the first row directly through $result->row which is an associative array that contains key/value pairs of the first row only, finally you can access all rows through $result->rows which is an array of associative arrays


来源:https://stackoverflow.com/questions/28468284/how-to-get-database-details-is-views-in-opencart

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!