我的Codeigniter脚本出现数据库错误

时间:2018-09-28 21:44:42

标签: php mysql sql codeigniter

我安装了学校管理系统,并且一次登录,但注销后输入用户名和密码,并显示以下消息框:

  

发生数据库错误,您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以在第2行的'WHERE _id IS NULL'附近使用正确的语法。 SELECT * WHERE _id为NULL。文件名:views / backend / header.php。行号:34英寸

header.php代码:

 <div class="row">
    <div class="col-md-12 col-sm-12 clearfix" style="text-align:center;">
    	<h2 style="font-weight:200; margin:0px;"><?php echo $system_name;?></h2>
    </div>
    <!-- Raw Links -->
    <div class="col-md-12 col-sm-12 clearfix ">

        <ul class="list-inline links-list pull-left">
        <!-- Language Selector -->
            <div id="session_static">
    	        <li>
    	            <h4>
    	           	    <a href="#" style="color: #696969;"
 <?php if($account_type == 'admin'):?>
    	           				onclick="get_session_changer()"
 <?php endif;?>>
 <?php echo get_phrase('running_session');?> : <?php echo $running_year.' ';?><i class="entypo-down-dir"></i>
    	           		</a>
    	           	</h4>
    	        </li>
            </div>
        </ul>


		<ul class="list-inline links-list pull-right">

		<li class="dropdown language-selector">
			<a href="<?php echo site_url('home');?>" target="_blank">
				<i class="entypo-globe"></i> Website
			</a>
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-close-others="true">
                        	<i class="entypo-user"></i>
													<?php
														$name = $this->db->get_where($this->session->userdata('login_type'), array($this->session->userdata('login_type').'_id' => $this->session->userdata('login_user_id')))->row()->name;
														echo $name;
													?>
                    </a>

				<?php if ($account_type != 'parent'):?>
				<ul class="dropdown-menu <?php if ($text_align == 'right-to-left') echo 'pull-right'; else echo 'pull-left';?>">
					<li>
						<a href="<?php echo site_url($account_type . '/manage_profile');?>">
                        	<i class="entypo-info"></i>
							<span><?php echo get_phrase('edit_profile');?></span>
						</a>
					</li>
					<li>
						<a href="<?php echo site_url($account_type . '/manage_profile');?>">
                        	<i class="entypo-key"></i>
							<span><?php echo get_phrase('change_password');?></span>
						</a>
					</li>
				</ul>
				<?php endif;?>
				<?php if ($account_type == 'parent'):?>
				<ul class="dropdown-menu <?php if ($text_align == 'right-to-left') echo 'pull-right'; else echo 'pull-left';?>">
					<li>
						<a href="<?php echo site_url('parents/manage_profile');?>">
                        	<i class="entypo-info"></i>
							<span><?php echo get_phrase('edit_profile');?></span>
						</a>
					</li>
					<li>
						<a href="<?php echo site_url('parents/manage_profile');?>">
                        	<i class="entypo-key"></i>
							<span><?php echo get_phrase('change_password');?></span>
						</a>
					</li>
				</ul>
				<?php endif;?>
			</li>

			<li>
				<a href="<?php echo site_url('login/logout');?>">
					<?php echo get_phrase('log_out'); ?><i class="entypo-logout right"></i>
				</a>
			</li>
		</ul>
	</div>

</div>

<hr style="margin-top:0px;" />

<script type="text/javascript">
	function get_session_changer()
	{
		$.ajax({
            url: '<?php echo site_url('admin/get_session_changer');?>',
            success: function(response)
            {
                jQuery('#session_static').html(response);
            }
        });
	}
</script>

第34行:

$name = $this->db->get_where($this->session->userdata('login_type'), array($this->session->userdata('login_type').'_id' => $this->session->userdata('login_user_id')))->row()->name;

我是初学者。请帮助我一步一步

0 个答案:

没有答案