Welcome Guest, Not a member yet? Register   Sign In
Error Number 1054 - Unknown column 'text_content_' in 'field list'
#1

[eluser]yuro[/eluser]
hello,

The site is not found on Google. It displays the status 500.

The following error message appears:

Quote:--Database Error--

<div id="content">
A Database Error Occurred

Error Number: 1054

Unknown column 'text_content_' in 'field list'
SELECT `text_content_` AS text_content, `menu`.`menu_name_` AS menu_name, `banner`
FROM (`content`)
LEFT JOIN `menu` ON `menu`.`content_id` = `content`.`content_id´
WHERE `content`.`content_id` = 1
</div>

In the data model_content.php is the programming of this part:
Code:
public function getContentDatabyId($id)
   {
      $this->db->select("text_content_".$this->session->userdata('web_lang')." AS text_content, menu.menu_name_".$this->session->userdata('web_lang')." AS menu_name,banner");
    $this->db->from($this->_tablesincorporated['content']);
    $this->db->join($this->_tablesincorporated['menu'], 'menu.content_id = content.content_id', 'LEFT');
    $this->db->where("content.content_id",$id);
    $query = $this->db->get(); //Here's the problem where gives me the Status 500, but when I commented this part, I get the Status 200, but than is the if-loop wrong.
      
      if($query->num_rows())
      {
         return $query->row();
      } else {
         return FALSE;
      }
   }

Help please Sad
#2

[eluser]smilie[/eluser]
Well, as MySQL itself said, table:

'text_content_'

does not exist. It is also a bit strange to see table ending with _
mostly is this so called table prefix.

Only way to solve this is to check in that database, what is correct name of the table.

Cheers,
Smilie
#3

[eluser]yuro[/eluser]
[quote author="smilie" date="1334056664"]

Only way to solve this is to check in that database, what is correct name of the table.
[/quote]

Thats my database:

The table called "content" with the column "content_id", "page_name", "text_content_en", "text_content_de", "text_content_it", "text_content_fr", "banner".

The problem is that he should choose a language from these columns.
How could I convert it?
#4

[eluser]smilie[/eluser]
Ok, seems that your:

Code:
$this->session->userdata('web_lang');

is not working as expected.
Can you echo just that and see if you have in there what you expect?

Cheers,
Smilie
#5

[eluser]yuro[/eluser]
frontendcontroler.php :
Code:
// set default language
  if(!$this->session->userdata('web_lang'))
  {
     $this->session->set_userdata(array('web_lang' => $lang_detection));
     $this->config->set_item('language', $lang_detection);
  } else {
     $this->config->set_item('language', $this->session->userdata('web_lang'));    
  }

ac_helper.php :
Code:
$CI =& get_instance();

$sql = "SELECT menu_id, parent_id, content_id, menu_name_".$CI->session->userdata('web_lang')." AS menu_name ";
$sql .= "FROM menu ";
$sql .= "WHERE menu_pos = 'top' AND published = '1'";

$query = $CI->db->query($sql);
$results = $query->result();

thats all!
#6

[eluser]yuro[/eluser]
please help Sad

I give you the login information, if you want to look in the php datas.
#7

[eluser]jvicab[/eluser]
The problem seems to be that $this->session->userdata('web_lang') is having nothing, so you should check why.
As smilie suggested, check $this->session->userdata('web_lang') first to see why it is not retunrning any value [try var_dump($this->session->userdata('web_lang'));]
#8

[eluser]yuro[/eluser]
Thankssssss it works :-) ..I'm so happy!!! Big Grin


edit: when I go to the website, it is on the upper left side "NULL". why?
#9

[eluser]yuro[/eluser]
hello,

my problem is not finished. The columns in the database are existing. But he says that are unknown column.

Code:
$this->db->select("text_content_".$this->session->userdata('web_lang')." AS text_content, menu.menu_name_".$this->session->userdata('web_lang')." AS menu_name,banner");
....
$query = $this->db->get();

What do I have for an alternative maybe?




Theme © iAndrew 2016 - Forum software by © MyBB