I have a codeigniter project. I have some dropdowns where i can select campus, session, class, group. I want filter data according to these dropdown values. Here is the function i call-
function student_feeConfig()
{
if ($this->session->userdata('admin_login') != 1)
redirect(base_url(), 'refresh');
$campus_id = -1;
$session_id = -1;
$class_id = -1;
$group_id = -1;
if($this->input->post('campus_id') !=null)
$campus_id = $this->input->post('campus_id');
if($this->input->post('session_id') !=null)
$session_id = $this->input->post('session_id');
if($this->input->post('class_id') !=null)
$class_id = $this->input->post('class_id');
if($this->input->post('group_id') !=null)
$group_id = $this->input->post('group_id');
if($this->input->post('section_id') !=null)
$section_id = $this->input->post('section_id');
$campus = $this->db->get('campus')->result_array();
$page_data['campus'] = array(''=>'Select one');
foreach($campus as $row):
$page_data['campus'][$row['id']] = $row['campus_name'];
endforeach;
$page_data['id'] = $campus_id;
$session = $this->db->get('session')->result_array();
$page_data['sessions'] = array(''=>'Select one');
foreach($session as $row):
$page_data['sessions'][$row['id']] = $row['uniqueCode'];
endforeach;
$page_data['session_id'] = $session_id;
$classinfo = $this->db->get_where('class', array('campus_id' => $campus_id))->result_array();
$page_data['classes'] = array(''=>'Select one');
foreach($classinfo as $row):
$page_data['classes'][$row['class_id']] = $row['name'];
endforeach;
$page_data['allclass']=$page_data['classes'];
$page_data['class_id'] = $class_id;
$groups = $this->db->get_where('class_group', array('class_id' => $class_id))->result_array();
$page_data['groups'] = array(''=>'Select one');
foreach($groups as $row):
$page_data['groups'][$row['id']] = $row['group_name'];
endforeach;
$page_data['group_id'] = $group_id;
if($class_id != -1) {
$this->db->select('enroll.group_id, student_feeConfig.*');
$this->db->from('enroll');
$this->db->join('student_feeConfig', 'enroll.student_id = student_feeConfig.student_id');
$this->db->where('enroll.class_id', $class_id);
$feeInfo = $this->db->get()->result_array();
$page_data['feeInfo'] = $feeInfo;
}
$page_data['page_name'] = 'student_feeconf';
$page_data['page_title'] = get_phrase('fee_management');
$this->load->view('backend/index', $page_data);
}
But i get error:
Error Number: 1054
Unknown column 'enroll.class_id' in 'where clause'
UPDATE `ci_sessions` SET `timestamp` = 1478060781 WHERE `enroll`.`class_id` = '4' AND `id` = 'a351278bf35ab714c6f3de3479627cb5c009c7a6'
Filename: libraries/Session/drivers/Session_database_driver.php
Line Number: 243
Your code is :
if($class_id != -1) {
$this->db->select('enroll.group_id, student_feeConfig.*');
$this->db->from('enroll');
$this->db->join('student_feeConfig', 'enroll.student_id = student_feeConfig.student_id');
$this->db->where('enroll.class_id', $class_id);
$feeInfo = $this->db->ge()->result_array();
$page_data['feeInfo'] = $feeInfo;
}
bellow line you used ->db->ge() like this
$feeInfo = $this->db->ge()->result_array();
Correction is bellow :
$feeInfo = $this->db->get()->result_array();
and add your enroll.class_id like bellow after if($class_id != -1) { condition:
$this->db->select('enroll.group_id, enroll.class_id, student_feeConfig.*');
Related
I need to get the value from the table - privacy_settings, column - city, based on user_id which is on my view {{ $user['id'] }} from table users, column id.
Here is my controller :
public function findUser($role = null,$search = null,$name = null,$country = null,$city = null,$industry = null,$department = null,$function_name = null,$timeframe =null,$language_skills = null,$organization_type = null,$contact_level = null,$page = null)
{
// if($page == "")
// {
// return redirect('find-user/'.Input::get('role').'/'.Input::get('search').'/1');
// }
// return $role;
// if($page == "")
// {
// $page = 1;
// }
$data = $this->data;
$data['users'] = User::all();
$page = Input::get('page'); // Get the current page or default to 1, this is what you miss!
$perPage = 12;
$offset = ($page * $perPage) - $perPage;
$data['role'] = Input::get('role');
$search = Input::get('search');
$name = Input::get('name');
$country = Input::get('country');
$city = Input::get('city');
$industry = Input::get('industry');
$language_skills = Input::get('language_skills');
$department = Input::get('department');
$function_name = Input::get('function_name');
$company = Input::get('company');
$timeframe = Input::get('timeframe');
$organization_type = Input::get('organization_type');
$contact_level = Input::get('contact_level');
$data['search'] = $search;
// DB::enableQueryLog();
$users = User::with('country','industry','organization_type','career_path','career_path.industry','career_path.department','career_path.functions','role');
$private = DB::table('privacy_settings')->get();
How can I do that? I guess it should be something like $private = DB::table('privacy_settings')->where('id', '=', 'city')->get();, but this doesn't working.
So, now I get the id o the user with {{ $user['id'] }} , from table Users, column id.
In table privacy_settings I have column user_id which has id of users and city with 2 values : 0 for public, and 1 for private. I need to get these values based on every user_id
So basically, fetch the collection from column user_id where user_id = the id you passed in your blade. replace $user['id'] with that value.
$temparr = [];
$buffer = 0;
foreach($users as $user){
$arr = [];
$privacy = PrivancySetting::where('user_id', $user['id'])->first();
$city = $privacy['city'];
if($city == 0){
$buffer = 0;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}else{
$buffer = 1;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}
}
Pass $temparr to your view and do a loop in it to cross check and hide what you need to hide!
Is it possible to insert in to two tables at once? I need to insert some data in to a table (students) and then based on the primary key insert in to another (enrollments). Is this possible?
The enrollments table however pulls other primary key from another table called schools (id).
public function add()
{
if(isset($_POST['submit'])) {
$this->student_validation();
if($this->form_validation->run() === TRUE) {
$data = $this->_get_posted_student_data();
$insert_id = $this->student->insert('students', $data);
if($insert_id) {
$this->__insert_enrollment($insert_id);
success($this->lang->line('insert_success'));
redirect('web/index/' . $data['front_school_id']);
} else {
error($this->lang->line('insert_failed'));
redirect('web/admission');
}
} else {
$this->data['post'] = $_POST;
}
}
$this->data['schools'] = $this->schools;
$this->data['add'] = TRUE;
$this->layout->title($this->lang->line('add') . ' ' . $this->lang->line('student') . ' | ' . SMS);
$this->layout->view('web/index', $this->data);
}
private function __insert_enrollment($insert_id)
{
$data = array();
$school = $this->student->get_school_by_id($this->input->post('front_school_id'));
$data['student_id'] = $insert_id;
$data['school_id'] = $this->input->post('front_school_id');
//$data['class_id'] = $this->input->post('class_id');
//$data['section_id'] = $this->input->post('section_id');
$data['academic_year_id'] = $school->academic_year_id;
//$data['roll_no'] = $this->input->post('roll_no');
$data['created_at'] = date('Y-m-d H:i:s');
//$data['created_by'] = logged_in_user_id();
$data['status'] = 1;
$this->db->insert('enrollments', $data);
}
private function _get_posted_student_data()
{
$items = array();
$school_id = $this->session->userdata('front_school_id');
$items[] = 'first_name';
$items[] = 'middle_name';
$items[] = 'last_name';
$items[] = 'gender';
$items[] = 'religion';
$items[] = 'dobpin';
$items[] = 'address';
$items[] = 'immunization_update';
$items[] = 'nationality';
$items[] = 'valid_permit';
$items[] = 'relation_father';
$items[] = 'father_name';
$items[] = 'father_phone';
$items[] = 'father_email';
$items[] = 'father_address';
$items[] = 'relation_mother';
$items[] = 'mother_name';
$items[] = 'mother_phone';
$items[] = 'mother_email';
$items[] = 'mother_address';
$items[] = 'other_sibling';
$items[] = 'name_sibling';
$items[] = 'class_sibling';
$items[] = 'name';
$items[] = 'relation';
$items[] = 'child';
$items[] = 'application_name';
$data = elements($items, $_POST);
$data['dob'] = date('Y-m-d', strtotime($this->input->post('dob')));
$data['admission_date'] = date('Y-m-d', strtotime($this->input->post('admission_date')));
$data['age'] = floor((time() - strtotime($data['dob'])) / 31556926);
$data['modified_at'] = date('Y-m-d H:i:s');
//$data['modified_by'] = logged_in_user_id();
$data['created_at'] = date('Y-m-d H:i:s');
//$data['created_by'] = logged_in_user_id();
$data['status'] = 1;
// create user
//$data['user_id'] = $this->student->create_user();
if($_FILES['birth_certificate']['name']) {
$data['birth_certificate'] = $this->_upload_birth_certificate();
}
if($_FILES['bill']['name']) {
$data['bill'] = $this->_upload_bill();
}
if($_FILES['immunization']['name']) {
$data['immunization'] = $this->_upload_immunization();
}
if($_FILES['photo']['name']) {
$data['photo'] = $this->_upload_photo();
}
return $data;
}
You need $this->db->insert_id() to get last inserted id which will get from this.
$this->db->insert('students', $data);
$insert_id = $this->db->insert_id();
if(!empty($insert_id)) {
$this->__insert_enrollment($insert_id);
success($this->lang->line('insert_success'));
redirect('web/index/' . $data['front_school_id']);
} else {
error($this->lang->line('insert_failed'));
redirect('web/admission');
}
Dears,
i have an excel file with 5K rows and i'm importing it to my table in the DB successfully.
But the error, when the system finish all the rows, it keeps looping and the page doesn't stop running and not redirecting to my view.
My controller:
if($request->hasFile('import_file')){
$path = $request->file('import_file')->getRealPath();
$data = \Excel::load($path)->get();
foreach ($data as $key => $row) {
$res = policies::where('phone', '=', $row['phone'])
->where('draft_no', '=', $row['draftno'])
->where('due_date', '=', $duedate)
->select('id')->get()->toArray();
if(empty($res)) {
$polic = new policies();
$polic->cust_id = $row['custno'];
$polic->policy = '';
$polic->bord_date = $borddate;
$polic->client_id = $row['clientid'];
$polic->client_no = $row['clientno'];
$polic->client_name = $row['clientname'];
$polic->draft_no = $row['draftno'];
if ($row['status'] == '') {
$polic->status = '';
} else {
$polic->status = $row['status'];
}
$polic->due_date = $duedate;
if ($row['curno'] == 'USD') {
$polic->currency = 1;
} else {
$polic->currency = 0;
}
$polic->amount = $row['amnt'];
$polic->zone = $row['zone'];
$polic->broker_id = $row['brokercode'];
$polic->broker_name = $row['brokername'];
$polic->remarks = $row['remarks'];
$polic->phone = $row['phone'];
$polic->insured_name = $row['insname'];
// $polic->cust_id = $row['valuedate'];
$polic->address = ''; //address
if (trim($row['status']) == 'P') {
$polic->paid_at = date('Y-m-d');
}
$polic->new = 1; //address
$polic->save();
}
else {
//am updating the imported date in the DB
}
what is very strange that in my localhost is working fine, but in digitaloceans cloud, keep looping without redirecting.
Thanks for your help.
I can be because you have 5000 rows to insert and 5000 insert operation consumes lots of memory. What you can try is batch insert operation.
In your policies.php make all fields fillable
protected $fillable=['cust_id ','policy','bord_date','client_id','client_no','client_name ','draft_no','bord_date','status','due_date','currency','amount','zone','broker_id','broker_name','remarks','phone','insured_name','address','paid_at','new'];
And on your excel file import use exists rather than getting collections.
if($request->hasFile('import_file')){
$path = $request->file('import_file')->getRealPath();
$data = \Excel::load($path)->get();
$data=[];
$i=0;
foreach ($data as $key => $row) {
$res = policies::where('phone', '=', $row['phone'])
->where('draft_no', '=', $row['draftno'])
->where('due_date', '=', $duedate)
->exists();
if(!$res) {
$i++;
$data[$i]['cust_id ']=$row['custno'];
$data['policy'] = '';
$data['bord_date'] = $borddate;
$data[$i]['client_id'] = $row['clientid'];
$data[$i]['client_no'] = $row['clientno'];
$data[$i]['client_name'] = $row['clientname'];
$data[$i]['draft_no'] = $row['draftno'];
if ($row['status'] == '') {
$data[$i]['status'] = '';
} else {
$data[$i]['status'] = $row['status'];
}
$data[$i]['due_date'] = $duedate;
if ($row['curno'] == 'USD') {
$data[$i]['currency'] = 1;
} else {
$data[$i]['currency'] = 0;
}
$data[$i]['amount'] = $row['amnt'];
$data[$i]['zone'] = $row['zone'];
$data[$i]['broker_id'] = $row['brokercode'];
$data[$i]['broker_name'] = $row['brokername'];
$data[$i]['remarks'] = $row['remarks'];
$data[$i]['phone'] = $row['phone'];
$data[$i]['insured_name'] = $row['insname'];
// $data[$i]['cust_id'] = $row['valuedate'];
$data[$i]['address'] = ''; //address
if (trim($row['status']) == 'P') {
$data[$i]['paid_at'] = date('Y-m-d');
}
$data[$i]['new'] = 1; //address
}
else {
//am updating the imported date in the DB
}
}
policies::insert($data);
I have pagination, and my pagination is working fine if I click next number.
View :
1 2 >
if I am clicking on 2 it goes on second page and shows proper result.but if I want to come back on 1 than its not redirect to page 1. here is my controller code:
public function index($date_start = 'all', $date_end = 'all', $title = 'all', $cid = 0, $skpd = 'all', $offset = NULL)
{
if($_POST)
{
$filter = array(
($this->input->post('filter_date_start') == '') ? 'all' : $this->input->post('filter_date_start'),
($this->input->post('filter_date_end') == '') ? 'all' : $this->input->post('filter_date_end'),
($this->input->post('filter_title') == '') ? 'all' : $this->input->post('filter_title'),
($this->input->post('filter_kategori') == 0) ? 0 : $this->input->post('filter_kategori'),
($this->input->post('filter_skpd') == '') ? 'all' : $this->input->post('filter_skpd')
);
$url = implode('/', $filter);
redirect('document/index'.$url);
}
//echo urldecode($title);
$this->load->model('News_model');
$this->load->library('pagination');
$data['title'] = 'Informasi Publik';
$param_document = array('status' => 1);
if(!empty($tid)) $param_document['tid'] = $tid;
if($date_start != 'all') $param_document['date_start'] = $date_start;
if($date_end != 'all') $param_document['date_end'] = $date_end;
if(!empty($cid)) $param_document['cid'] = $cid;
if($title != 'all') $param_document['title'] = urldecode($title);
if($skpd != 'all') $param_document['skpd'] = $skpd;
$params_total = $param_document;
$param_document_berkala = $param_document;
$param_document_serta_merta = $param_document;
$param_document_setiap_saat = $param_document;
$param_document_dikecualikan = $param_document;
$param_document['limit'] = 10;
$param_document['offset'] = $offset;
$data['document'] = $this->Document_model->get($param_document);
//dimodif cara urang
$data['bijilkategori'] = $this->Document_model->tampil();
// get document download count
foreach($data['document'] as $i => $row)
{
$document_transaction = $this->Document_model->get_transaction(array('did' => $row['document_id']));
$data['document'][$i]['download_count'] = empty($document_transaction) ? 0 : $document_transaction[0]['count'];
}
/*
$config['base_url'] = site_url('document/index/'.
(empty($tid) ? 0 : $tid).'/'.$date_start.'/'.$date_end.'/'.
$title.'/'.(empty($cid) ? 0 : $cid).'/'.$skpd
);
*/
$config['base_url'] = site_url('document/index/'.
$date_start.'/'.$date_end.'/'.
$title.'/'.(empty($cid) ? 0 : $cid).'/'.$skpd
);
$config['total_rows'] = count($this->Document_model->get($params_total));
$config['uri_segment'] = 9;
$this->pagination->initialize($config);
$data['main'] = 'document/document_indeks';
$data['kategori'] = $this->get_category();
$data['type'] = $this->get_type(TRUE);
$data['filter_kategori'] = $cid;
//dihidden ku urang
//$data['filter_type'] = $tid;
$data['filter_date_start'] = ($date_start == 'all') ? '' : $date_start;
$data['filter_date_end'] = ($date_end == 'all') ? '' : $date_end;
$data['filter_title'] = ($title == 'all') ? '' : $title;
$data['filter_author'] = ($skpd == 'all') ? '' : $skpd;
$param_document_berkala['tid'] = 1;
$param_document_serta_merta['tid'] = 2;
$param_document_setiap_saat['tid'] = 3;
$param_document_dikecualikan['tid'] = 4;
$data['total_record'] = count($this->Document_model->get($params_total));
$data['total_record_berkala'] = count($this->Document_model->get($param_document_berkala));
$data['total_record_serta_merta'] = count($this->Document_model->get($param_document_serta_merta));
$data['total_record_setiap_saat'] = count($this->Document_model->get($param_document_setiap_saat));
$data['total_record_dikecualikan'] = count($this->Document_model->get($param_document_dikecualikan));
$this->load->view('layout', $data);
}
Model:
public function get($params = array())
{
if(isset($params['fields']))
{
$this->db->select($params['fields']);
}
else
{
$this->db->select('*');
}
if(isset($params['id']))
{
$this->db->where('document.document_id', $params['id']);
}
elseif(isset($params['code']))
{
$this->db->where('document_code', $params['code']);
}
elseif(isset($params['date_start']) AND isset($params['date_end']))
{
$this->db->where('document_date >=', $params['date_start'].' 00:00:00');
$this->db->where('document_date <=', $params['date_end'].' 23:59:59');
}
elseif(isset($params['tid']))
{
$this->db->where('type_id', $params['tid']);
}
elseif(isset($params['cid']))
{
$this->db->where('document.category_id', $params['cid']);
}
elseif(isset($params['uid']))
{
$this->db->where('user_id', $params['uid']);
}
elseif(isset($params['sid']))
{
$this->db->where('document.skpd_id', $params['sid']);
}
if(isset($params['title']))
{
$this->db->like('document_title', $params['title']);
}
if(isset($params['author']))
{
$this->db->like('document_author', $params['author']);
}
elseif(isset($params['date']))
{
$this->db->where('document_date', $params['date']);
}
if(isset($params['dsid']))
{
$this->db->where('document_skpd_id', $params['dsid']);
}
if(isset($params['status']))
{
$this->db->where('document_is_published', $params['status']);
}
if(isset($params['document_sync']))
{
$this->db->where('document_sync', $params['document_sync']);
}
if(isset($params['sync']))
{
$this->db->reset_query();
$this->db->select('document.*');
$this->db->where('document_sync', $params['sync']);
}
if(isset($params['limit']))
{
if(!isset($params['offset']))
{
$params['offset'] = NULL;
}
$this->db->limit($params['limit'], $params['offset']);
}
if(isset($params['order_by']))
{
$this->db->order_by($params['order_by'], 'desc');
}
else
{
$this->db->order_by('document_date', 'desc');
}
$this->db->select('document.document_id');
$this->db->join('user_desktop', 'user_desktop.user_desktop_id = document.operator_id');
$this->db->join('(SELECT document_id, MAX(document_file_id) AS document_file_max_id FROM document_file GROUP BY document_id) AS document_file_max', 'document.document_id = document_file_max.document_id', 'left', FALSE);
$this->db->join('document_file', 'document_file.document_file_id = document_file_max.document_file_max_id', 'left');
$this->db->join('document_type', 'document_type.document_type_id = document.type_id');
$this->db->join('document_form', 'document_form.document_form_id = document.form_id');
$this->db->join('document_category', 'document_category.category_id = document.category_id');
$this->db->join('skpd', 'skpd.skpd_id = document.skpd_id');
$res = $this->db->get('document');
if(isset($params['id']))
{
return $res->row_array();
}
else
{
return $res->result_array();
}
}
Please master how to fix it ? whst is problem on my pagination
Please try this :
$config['base_url'] = site_url('document/index/'.
$date_start.'/'.$date_end.'/'.
$title.'/'.(empty($cid) ? 0 : $cid).'/'.$skpd.'/'
);
$config['uri_segment'] = 8;
in your base_url you missed out / at the end and codeigniter places offset for pagination. Hence, uri_segment would be 8.
I´m pretty much entirely new to PHP, so please bear with me.
I´m trying to build a website running on a cms called Core. I'm trying to make it so that the previous/next buttons cycle through tags rather than entries. Tags are stored in a database as core_tags. Each tag has it own tag_id, which is a number. I've tried changing the excisting code for thep previous/next buttons, but it keeps giving me 'Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/core/functions/get_entry.php on line 50'.'
Any help would be greatly appreciated.
Get_entry.php:
<?php
$b = $_SERVER['REQUEST_URI'];
if($entry) {
$b = substr($b,0,strrpos($b,"/")) . "/core/";
$id = $entry;
$isPerma = true;
} else {
$b = substr($b,0,mb_strrpos($b,"/core/")+6);
$id = $_REQUEST["id"];
}
$root = $_SERVER['DOCUMENT_ROOT'] . $b;
$http = "http://" . $_SERVER['HTTP_HOST'] . substr($b,0,strlen($b)-5);
require_once($root . "user/configuration.php");
require_once($root . "themes/".$theme."/configuration.php");
require_once($root . "functions/session.php");
if(is_numeric($id)) {
$type = "entry";
} else {
$type = "page";
}
$id = secure($id);
if($type == "page") {
$data = mysql_query("SELECT p.* FROM core_pages p WHERE p.page_title = \"$id\"");
$page_clicks = 0;
while($p = mysql_fetch_array($data)) {
$url = $p["page_url"];
$path = $root . "user/pages/" . $url;
$page_clicks = $p['hits']+1;
require($path);
}
mysql_query("UPDATE core_pages p SET
p.hits = $page_clicks
WHERE p.page_title = $id");
}
if($type == "entry") {
// queries the dbase
$data_tags = mysql_query("SELECT entry_id,entry_title FROM core_entries WHERE entry_show = 1 ORDER BY entry_position DESC") or die(mysql_error());
$navArr=array();
while($tmparray = mysql_fetch_array($data_entries,MYSQL_ASSOC)){
array_push($navArr,$tmparray['entry_id']);
}
function array_next_previous($array, $value) {
$index = array_search($value,$array);
//if user clicked to view the very first entry
if($value == reset($array)){
$return['prev'] = end($array);
$return['next'] = $array[$index + 1];
//if user clicked to view the very last entry
}else if($value == end($array)){
$return['prev'] = $array[$index - 1];
reset($array);
$return['next'] = current($array);
}else{
$return['next'] = $array[$index + 1];
$return['prev'] = $array[$index - 1];
}
return $return;
}
$data = mysql_query("SELECT e.* FROM core_entries e WHERE e.entry_id = $id AND e.entry_show = 1");
$entry_clicks = 0;
if(#mysql_num_rows($data) < 1) {
die("Invalid id, no entry to be shown");
}
while($e = mysql_fetch_array($data)) {
$nextPrevProject = array_next_previous($navArr,$id);
$entry_id = $e['entry_id'];
$entry_title = $e['entry_title'];
// DATE
$t = $e["entry_date"];
$y = substr($t,0,4);
$m = substr($t,5,2);
$d = substr($t,8,2);
$entry_date = date($date_format,mktime(0,0,0,$m,$d,$y));
$entry_text = $e['entry_text'];
$entry_extra1 = $e['entry_extra1'];
$entry_extra2 = $e['entry_extra2'];
$entry_client = $e['entry_client'];
$entry_position = $e['entry_position'];
$entry_hits = $e['hits']+1;
$entry_new = $e['entry_new'];
if($entry_new == 1) {
$isNew = true;
} else {
$isNew = false;
}
if($nice_permalinks) {
$entry_perma = "$http".$entry_id;
} else {
$entry_perma = "$http"."?entry=$entry_id";
}
$data_e2t = #mysql_query("SELECT e2t.tag_id FROM core_entry2tag e2t WHERE e2t.entry_id = $entry_id");
$tag_str = "";
while($e2t = #mysql_fetch_array($data_e2t)) {
$tag_id = $e2t["tag_id"];
$data_tags = #mysql_query("SELECT t.tag_text FROM core_tags t WHERE t.tag_id = $tag_id");
while($t = #mysql_fetch_array($data_tags)) {
$tag_text = $t["tag_text"];
$tag_str = $tag_str . "<a class=\"tag-link\" name=\"tag".$tag_id."\" href=\"#tag-"._encode($tag_text)."\">".$tag_text."</a>".$separator_tags;
}
}
$entry_tags = substr($tag_str,0,strlen($tag_str)-strlen($separator_tags));
$layout_path = $root . "user/uploads/" . treat_string($entry_title) . "/layout.php";
if(is_file($layout_path) && (#filesize($layout_path) > 0)) {
require($layout_path);
} else {
require($theme_path . "parts/entry.php");
}
}
mysql_query("UPDATE core_entries e SET
e.hits = $entry_hits
WHERE e.entry_id = $id");
}
if($isPerma) {
echo "<a class=\"index-link\" href=\"$http\">back to index</a>";
}
?>
You have not defined $data_entries, before using it here:
while($tmparray = mysql_fetch_array($data_entries,MYSQL_ASSOC)){
array_push($navArr,$tmparray['entry_id']);
}
That is why you get the very descriptive error message.
Did you mean to use $data_tags?
Use: "SELECT p.* FROM core_pages p WHERE p.page_title = '".$id."'
Note: mysql_connect is not sql-injection save. If you use mysql_connect, change to PDO.
$data_entries is not defined on line 50, then mysql_fetch_array return an exception of null value given.
Try to change $tmparray = mysql_fetch_array($data_entries,MYSQL_ASSOC) to $tmparray = mysql_fetch_array($data_tags,MYSQL_ASSOC).
Hope this help!