如果你们需要其他信息,那么上一个问题就在这里:
另一个更新
尽管你们所有人都非常有帮助。我已经设法获得了输出,但我仍然真的很困惑,可以说我想首先看到输出,所以我无视控制器。
在我看到我的命令是正确的之后,我会制作一个控制器 :) 我不知道为什么,但这就是我如何理解整个概念的方式。反正..
对于我的 membership_model.php
function member_here()
{
$this->db->select('');
$this->db->from('membership');
$this->db->where('username',$this->input->post('username'));
$q=$this->db->get('');
if($q->num_rows() > 0) {
$data = array();
foreach($q->result() as $row) {
$data=$row;
}
return $data;
}
}
和我的signup_view.php
<html>
<head>
<title></title>
</head>
<body>
<?php $this->load->view('includes/header')?>
<div align="right"><?php echo anchor('login/signin', 'Login');?></div>
<?php
$option1 = array(
'name' => 'What was your childhood nickname?',
'value' => 'What was your childhood nickname?'
);
$option2= array(
'name' => 'What is your pet\'s name?',
'value' => 'What is your pet\s name?'
);
$option3= array(
'name' => 'In what city were you born?',
'value' => 'In what city were you born?'
);
$option4= array(
'name' => 'What is the color of your eyes?',
'value' => 'What is the color of your eyes?'
);
$option5= array(
'name' => 'What is your favorite color?',
'value' => 'What is your favorite color?'
);
echo form_open('login/create_member');
echo "<table width=\"80%\ cellpadding=\"3px\">
<tr>
<td>User Information:</td>
</tr>
<tr>
<td> </td>
</tr>";
echo "<tr><td>First Name*: </td></tr>";
echo "<tr><td>";
echo form_input('first_name', set_value('first_name'));
echo "</tr></td>";
echo "<tr><td>Last Name*: </td></tr>";
echo "<tr><td>";
echo form_input('last_name', set_value('last_name'));
echo "</td></tr>";
echo "<tr><td>Email Address*: </td></tr>";
echo "<tr><td>";
echo form_input('email_address', set_value('email_address'));
echo "</tr></td>";
echo "<tr><td>Gender: </td></tr>";
echo "<tr><td>";
?>
<input type="radio" name="gender" value="Male" />Male
<input type="radio" name="gender" value="Female" />Female
<?php
echo "</tr></td>";
echo "<tr>
<td></td>
</tr>
</table>";
?>
<?php
echo "<table width=\"80%\ cellpadding=\"3px\">
<tr>
<td> Account Information:</td>
</tr>
<tr>
<td> </td>
</tr>";
echo "<tr><td>Userame*: </td></tr>";
echo "<tr><td>";
echo form_input('username', set_value('username'));
echo "</td></tr>";
echo "<tr><td>Password*: </td></tr>";
echo "<tr><td>";
echo form_password('password');
echo "</td></tr>";
echo "<tr><td>Password Confirmation*: </td></tr>";
echo "<tr><td>";
echo form_password('password2');
echo "</td></tr>";
echo "<tr><td>";
echo "Security Question*:";
echo "</td></tr>";
echo "<tr><td>";
?>
<select name = "security_question" value="security question">
<option value = "What was your childhood nickname?">What was your childhood nickname?</option>
<option value = "What is your pet's name?">What is your pet's name?</option>
<option value = "In what city were you born?">In what city were you born?</option>
<option value = "What is the color of your eyes?">What is the color of your eyes?</option>
<option value = "What is your favorite color?">What is your favorite color?</option>
</select>
<?php
echo "</td></tr>";
echo "<tr><td>";
echo "Security Answer*:";
echo "</td></tr>";
echo "<tr><td>";
echo form_input('security_answer');
echo "</td></tr>";
echo "<tr><td>";
echo form_submit('submit', 'Register');
echo form_reset('reset', 'Reset');
echo "</tr></td>";
echo form_close();
echo "<tr>
<td></td>
</tr>
</table>";
?>
<?php echo validation_errors('<p class="error">');?>
所以,这就是我所有的代码。我试图从数据库中获取登录用户的名字、姓氏、电子邮件地址和所有其他信息。
如果我使用$data[]=$row;
而不是$data=$row;
在我的模型中使用,则会出现以下错误:
Severity: Notice
Message: Trying to get property of non-object
Filename: views/members_area.php
Line Number: 20
所以我该怎么做。我在没有控制器的情况下编码。我只是检查结果 谢谢!