如何获取数据库详细信息是opencart中的视图 [英] How to get database details is views in opencart

查看:167
本文介绍了如何获取数据库详细信息是opencart中的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在视图tpl中编写查询,但是我不知道如何获取数据库详细信息并在opencart的视图中执行该查询.这是我的代码

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 ");

推荐答案

为什么使用本机函数编​​写查询会困扰自己,打开购物车会为您提供一些帮助

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

  • 首先,请阅读这篇文章,它很棒,并为我提供了很多帮助此处
  • 您现在可以通过
    $result = $this->db->query("write your query here");
    执行查询 您可以通过$result->num_rows获取返回的行数,可以直接通过$result->row访问第一行,该关联数组仅包含第一行的键/值对,最后您可以通过这是一个关联数组的数组
  • 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

这篇关于如何获取数据库详细信息是opencart中的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆