我的codeigniter脚本有数据库错误

zsbz8rwp  于 2021-06-19  发布在  Mysql
关注(0)|答案(0)|浏览(120)

我安装了一个学校管理系统,一次登录,但在注销并输入用户名和密码后,会显示一个带有以下消息的框:
发生数据库错误,您的sql语法有错误;请查看与mysql服务器版本对应的手册,以了解在“where”附近使用的正确语法 _id 在第2行为空。选择*位置 _id 为空。文件名: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;

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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题