我试过这个代码
CREATE TABLE users (
userId INT PRIMARY KEY AUTO_INCREMENT NOT NUll,
account VARCHAR(200) NOT NULL,
password varchar(200) NOT Null,
isActive varchar(10) NOT NUll,
createdDate DATETIME DEFAULT CURRENT_TIMESTAMP() NOT NUll,
updatedDate DATETIME
);
Run Code Online (Sandbox Code Playgroud)
但会出现以下错误
谢谢
我正在使用以下代码,但只会得到一个结果。
function group($id)
{
$this->db->select('groupId,groupName');
$this->db->from('groups');
$this->db->where('createdBy',$id);
$query = $this->db->get();
foreach($result=$query->row_array() as $row)
{
print_r($result);
}
}
Run Code Online (Sandbox Code Playgroud)
如何显示数据库中的所有值?请帮助我。
我使用以下代码将数组值传递给mysql查询,但数组到字符串转换错误将来
$sql =mysql_query("SELECT userId from groupmembers where groupId='$groupId'");
$bjson = array();
$i = 0;
while($result=mysql_fetch_assoc($sql))
{
$bjson[$i]['userId'] = $result['userId'];
$i++;
}
$query = "SELECT firstName
FROM users
WHERE userId IN('" . implode("','", $bjson) ."')";
Run Code Online (Sandbox Code Playgroud) 我使用以下代码为字符串添加单引号
$gpids=implode("','",array_unique($groupIds));
Run Code Online (Sandbox Code Playgroud)
我的输出就像这些156','155','161','151','162','163我希望我的输出像'156','155','161','151','162 ','163'请帮助我