Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function myRow($sql)
- {
- $this->connect();
- $rec = $this->conn->query($sql);
- $this->recordCount = $rec->num_rows;
- if ($this->makeRecordCount) {
- $this->totalRecordCount = $this->recordCount;
- }
- if ($this->recordCount > 0) {
- $names = array();
- $result = array();
- $temp = array();
- $count = $rec->field_count;
- // Get fields name
- while ($fields = mysqli_fetch_field($rec)) {
- $names[] = $fields->name;
- }
- while ($row = $rec->fetch_assoc()) {
- foreach ($names as $name) {
- $temp[$name] = $row[$name];
- }
- array_push($result, $temp);
- }
- } else {
- $result = null;
- }
- $this->conn->close();
- return $result;
- }
- $sql = "SELECT * FROM `table`";
- $datas = $class->myRow($sql);
- $smarty->assign('datas', $datas);
- $class->connect();
- $sql = "SELECT * FROM `table`";
- $datas = $class->myRow($sql);
- $smarty->assign('datas', $datas);
- $sql = "SELECT * FROM `table2`";
- $datas = $class->myRow($sql);
- $smarty->assign('data2s', $data2s);
- $class->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement