如果有,我有个关于循环的问题。目前,我的代码如下所示:
$rtitle = "SELECT title FROM table WHERE genre='$category'";
$ptitles = mysqli_query($connection,$rtitle) or die(mysqli_error($connection));
while ($title2 = mysqli_fetch_object($ptitles));
printf('"name": "%s",&
我有这样的领域:
id,标题,类型
类型为enum,我想通过type列验证我的标题,例如:
id | title | type
1 | test | option1
2| test | option2
因此,当有人试图插入带有此条件的行时,应处理验证,以确定列的唯一性。
3 | test | option1 ==> should not be insert due unique validation rule.
我的验证规则会是什么样子?
问候
//编辑1:规则外观是解决方案。
以前我使用Codeigniter 3,我加载所有的助手,库使用autoload.php。现在迁移到CI4,在那里我尝试了以下内容:
我尝试在BaseController.php中加载我的助手文件
我也尝试在我的__construct上加载Controller.php中的助手。
我有一个图书馆说Demo.php和函数check_user_logged()。当我从函数中调用我的get_cookie()时,它是Call to undefined function App\Libraries\get_cookie()。
此函数在从控制器调用时为check_user_logged(),
我的HTML代码中有一个标题,它通过ruby显示文本(顺便说一句,这些单元格有很多例子):
<td title="id:<%= alert.id %>">Hello</td>
我将创建一个助手方法(例如):
def admin?
# check if this user is an admin
end
如何使用此助手方法将标题的显示限制为管理用户?
考虑到我从文件夹(g-映像/)创建库的工作代码以及使用标题的文件名,如何从这些标题中排除除*.jpg (即*.png、*.gif)以外的其他文件扩展名?
目前唯一被删除的扩展是*.jpg。如果它是任何其他的扩展,它作为图片标题的一部分.
帮助,这里的新手:-)
<?php
$imglist = array();
$img_folder = "g-images/";
//use the directory class
$imgs = dir($img_folder);
//read all files from the directory