
默认情况下它不应该在操作栏下面吗?那么我做错了什么?
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
Run Code Online (Sandbox Code Playgroud)
RES /菜单/ main.xml中
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.test.MainActivity" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
</menu>
Run Code Online (Sandbox Code Playgroud) 我正在尝试更新一个表格,其中输入行的ID并通过下拉列表选择标题,但我有两个问题.首先我不知道如何将数据传递给模型,第二个问题实际上是使用活动记录更新表.
控制器类
class Update extends CI_Controller {
public function __construct()
{
parent::__construct();
//$this->load->model('addmodel');
//$this->load->helper('form');
}
public function index()
{
$this->load->view('updview');
}
public function updtitle()
{
$data = array(
'id' => $this->input->post('id'),
'title' => $this->input->post('title') );
//$data1['data'] = $data;
$data1['data'] = $this->updmodel->upddata($data);
$this->load->view('updview', $data1);
}
}
?>
Run Code Online (Sandbox Code Playgroud)
模特课
class Updmodel extends CI_Model {
// model constructor function
function __construct() {
parent::__construct(); // call parent constructor
$this->load->database();
}
public function upddata($data) {
$this->db->where('emp_no', $data['id']);
$this->db->update('title', $data['title']);
return;
}
}
?>
Run Code Online (Sandbox Code Playgroud)
视图
我似乎不能并排放置一个徽标和一张桌子,但彼此之间的距离不是很近。我能够实现这一目标的唯一方法是使用表格,但图像和表格变得非常接近。我想要页面中间的表格,以及表格和左侧屏幕远端之间的徽标。
像这样
标志表
这是现在的样子
标识
- -桌子
<div id="header" style="height:15%;width:100%;">
<img src="/e-com/images/logo.jpg" style="margin-left:15%;margin-top:5%"/>
<table border="1" width="44" style="margin-left:30%;float:top;">
<tr>
<td><h1><a href="home">Home</a></h1></td>
<td><h1><a href="home">Home</a></h1></td>
<td><h1><a href="home">Home</a></h1></td>
</tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud) SELECT attribute_value.value
FROM attribute_value
INNER JOIN attributes ON attributes.id=attribute_value.attribute_id
WHERE attributes.attribute IN (colour, size);
Run Code Online (Sandbox Code Playgroud)
我没有这样做,但我得到的错误是#1054 - 'where子句'中的未知列'颜色'
我正在尝试获取与之关联的属性的值.现在属性在"IN"子句中列出,但我想知道如何使用这样的关联数组:
Array([attributes] => Array ( [0] => Colour [1] => Size )
Run Code Online (Sandbox Code Playgroud)
表attribute_value
______________________________
| attribute_id | value |
------------------------------
| 1 | Red |
| 1 | Blue |
| 2 | Large |
Run Code Online (Sandbox Code Playgroud)
表属性
____________________
| id | attribute |
--------------------
| 1 | Colour |
| 2 | Size |
Run Code Online (Sandbox Code Playgroud)
为了澄清,将发布多个属性并仅使用这些属性,从attribute_value获取值,其中属性中的属性id等于attribute_value中的attribute_id