Welcome Guest, Not a member yet? Register   Sign In
PHP Error & DB Error - Problem with query at last update
#1

[eluser]vrsupport[/eluser]
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/blueplan/public_html/gold/modules/gold/controllers/admin/gold.php:2)

Filename: codeigniter/Common.php

Line Number: 360


A Database Error Occurred
Error Number: 1054

Unknown column 'g.country_id' in 'where clause'

SELECT `g`.*, `c`.`country_name` as country FROM (`be_goldrate` as g) LEFT JOIN `be_country` as c ON `c`.`country_id`=`g`.`country_id` WHERE `g`.`country_id` = '1' ORDER BY `g`.`gold_id` desc LIMIT 1
#2

[eluser]solid9[/eluser]
First error,
Try removing the echo.

Second error,
That's very obvious the column doesn't exist.


For the first error better post your controller codes.
#3

[eluser]vrsupport[/eluser]
<?php

if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
* BackendPro
*
* A website backend system for developers for PHP 4.3.2 or newer
*
* @package BackendPro
* @goldor Adam Price
* @copyright Copyright © 2008
* @license http://www.gnu.org/licenses/lgpl.html
* @LinK http://www.kaydoo.co.uk/projects/backendpro
* @filesource
*/
// ---------------------------------------------------------------------------

/**
* Members
*
* Allow the user to manage website users
*
* @package BackendPro
* @subpackage Controllers
*/
class Gold extends Admin_Controller {

function Gold() {
parent::Admin_Controller();

$this->current_module = 'manager';
$this->load->module_model('country', 'country_model');
$this->load->module_model('gold', 'gold_model');
$this->load->module_model('gold', 'goldrate_model');
$this->load->module_model('gold', 'priceupdate_model');
// $this->load->module_model('gold','suppliers_model');
$this->load->helper('form');

// Load userlib language
$this->lang->load('userlib');

// Set breadcrumb
$this->bep_site->set_crumb($this->lang->line('backendpro_items'), 'gold/admin/items');

// Check for access permission
check('Gold');

// Load the validation library
$this->load->library('validation');
$this->load->library('pagination');
log_message('debug', 'BackendPro : Items class loaded');
}

/**
* View Members
*
* @access public
*/
function index() {
// Get Member Infomation

$this->listGold();
}

function listGold() {
$countries = $this->country_model->getCountries()->result();
$goldrates = array();
foreach($countries as $country) {
$q = $this->goldrate_model->getGoldrate(array('g.country_id'=>$country->country_id), 'g.gold_id desc', array('limit'=>1, 'offset'=>0));
$goldrate = $q->row(0, 'array');
if(!$goldrate) {
$q = $this->goldrate_model->getGoldrate(null, 'g.gold_id desc', array('limit'=>1, 'offset'=>1));
$tgoldrate = $q->row(0, 'array');
$tgoldrate['date'] = date("Y-m-d H:iConfused");
$tgoldrate['country_id'] = $country->country_id;
unset($tgoldrate['gold_id']);
unset($tgoldrate['country']);
$this->goldrate_model->insert('Goldrate', $tgoldrate);
$q = $this->goldrate_model->getGoldrate(array('g.country_id'=>$country->country_id), 'g.gold_id desc', array('limit'=>1, 'offset'=>0));
$goldrate = $q->row(0, 'array');
}
if($goldrate) $goldrates[$goldrate['country_id']] = $goldrate;
}
/* $gold = $this->gold_model->getGold(NULL,'gold_id desc',array('limit'=>1))->row_array(); */
$data['golds'] = $goldrates;

// Display Page
$data['header'] = "Gold Prices";
$data['page'] = $this->config->item('backendpro_template_admin') . "gold/view";
$data['module'] = 'gold';
$this->load->view($this->_container, $data);
}

function form($id = NULL) {
// VALIDATION FIELDS
$fields['id'] = "ID";
$fields['aktg'] = "gold-8-9kt";
$fields['bktg'] = "gold-10kt";
$fields['cktg'] = "gold-14kt";
$fields['dktg'] = "gold-18kt";
$fields['ektg'] = "gold-22kt";
$fields['fktg'] = "gold-24kt";
$fields['gktg'] = "bangles-10ktg";
$fields['hktg'] = "bangles-14ktg";
$fields['iktg'] = "mixed-8ktg";
$fields['jktg'] = "mixed-9ktg";
$fields['kktg'] = "mixed-10ktg";
$fields['mktg'] = "mixed-12ktg";
$fields['nktg'] = "mixed-14ktg";
$fields['lktg'] = "mixed-18ktg";
$fields['oktg'] = "mixed-22ktg";
$fields['pktg'] = "silver";
$fields['date'] = "date";
$this->validation->set_fields($fields);
/* $fields['date'] = "date"; */
$rules['aktg'] = "trim|required|numeric";
$rules['bktg'] = "trim|required|numeric";
$rules['cktg'] = "trim|required|numeric";
$rules['dktg'] = "trim|required|numeric";
$rules['ektg'] = "trim|required|numeric";
$rules['fktg'] = "trim|required|numeric";
$rules['gktg'] = "trim|required|numeric";
$rules['hktg'] = "trim|required|numeric";
$rules['iktg'] = "trim|required|numeric";
$rules['jktg'] = "trim|required|numeric";
$rules['kktg'] = "trim|required|numeric";
$rules['mktg'] = "trim|required|numeric";
$rules['nktg'] = "trim|required|numeric";
$rules['lktg'] = "trim|required|numeric";
$rules['oktg'] = "trim|required|numeric";
$rules['pktg'] = "trim|required|numeric";

if ($this->input->post('submit')) {
//$this->validation->set_default_value('confirm_password',$this->input->post('confirm_password'));
// Form submited, check rules
$this->validation->set_rules($rules);
}
$this->validation->id = $id;
// RUN
if ($this->validation->run() === FALSE) {
// Display form
$this->validation->output_errors();
$data['header'] = ( is_null($id) ? "Create Item" : "Edit Gold Prices");
$this->bep_site->set_crumb($data['header'], 'gold/admin/gold/form/' . $id);
$data['page'] = $this->config->item('backendpro_template_admin') . "gold/form_gold";
$data['module'] = 'gold';
$this->load->view($this->_container, $data);
} else {
// Save form
/* if( is_null($id))
{ */
// CREATE
// Fetch form values
$golds = $this->_get_gold_details();
$golds['country_id'] = $id;


$this->db->trans_begin();

$this
#4

[eluser]vrsupport[/eluser]
the be_goldrate table and the be_country table both have a column:

country_id int(11)
#5

[eluser]codeartist[/eluser]
Hey Mikel,

Problem with Gold project ? ... I know what exactly is the problem ... Smile you can't fix it because the backendpro I used for that system only works upto CI verson 1.7.3 after that the system wont work ... in higher version of php ... man why are not you responding me ... you havent cleared money of this project ... how can you do this to me man ?




Theme © iAndrew 2016 - Forum software by © MyBB