我想在点击"Paging.php"中的某个图像时增加页面浏览量("num_views")数据库值,这样我就可以跟踪该图像的查看次数
Paging.php:
while ($imageCounter < $imagesPerPage && ($row = $catResult->fetch_assoc())) {
echo "<br />ID: " . $row['imgid'] .
'<br /><a href="./templates/viewcomic.php?views='. $row['num_views'].'&id=' . $row['imgid'] . '&image=' . $imgpath.$row['imgname'] . '"><img src="' . $thumbpath.$row['imgthumb'] . '"/></a>' .
"<br />CATFK: " . $row['catfk'] .
"<br/>";
$imageCounter++;
}
Run Code Online (Sandbox Code Playgroud)
ViewComic.php
<?php
include 'include/header.php';
$imgid = $_GET['id'];
$views = $_GET['views'];
include '../scripts/dbconnect.php';
$mysqli->query("UPDATE child_images SET num_views = ($views+1) WHERE imgid = $imgid");
mysqli_close($mysqli);
?>
Run Code Online (Sandbox Code Playgroud)
但它似乎没有增加
如何为动态生成的元素生成不同的CSS?
我的问题在这里:我们有一个日期选择器小部件,它th生成了表元素,text-align:left.当它离开时,左边th对齐,但是右边>>拼凑在一起.当我将它们对齐时,会出现相反的问题.我需要做的是适用align left于第一个<<和align right最后一个>>.但这些项目是动态生成的.正在使用SCSS规则.
th { text-align: left }

th {text-align: right }

每个日期选择器,<<,2007年6月,和>>在不同的th内部tr:


我正在Laravel 5.1上运行迁移,并且正在将数据库从Mysql切换到Postgres.
通常,我可以在运行down迁移之前将外键检查设置为0 :
- DB::statement('SET FOREIGN_KEY_CHECKS = 0');
- Do stuff
- DB::statement('SET FOREIGN_KEY_CHECKS = 1');
Run Code Online (Sandbox Code Playgroud)
Postgres不提供这个.
在减少迁移时,我收到错误:
依赖对象仍然存在:7错误:无法删除表table2,因为其他对象依赖于它
详细信息:表table1_table2上的约束table1_table2_table1_id_foreign取决于表table2
提示:使用DROP ... CASCADE也可以删除相关对象.(SQL:drop table"table2")
问题:当我设置->onDelete('cascade');外国创作时,这个投诉对我很好奇.为什么会这样?
摘录:
创建Table1表:
...
public function down()
{
Schema::drop('table1_table2');
Schema::drop('table1');
}
Run Code Online (Sandbox Code Playgroud)
创建Table2表(在表1迁移后调用):
...
public function down()
{
Schema::drop('table2');
}
Run Code Online (Sandbox Code Playgroud)
创建外键表(要调用的上次迁移)
public function up()
{
Schema::table('table1_table2', function(Blueprint $table)
{
$table->foreign('table1_id')->references('id')->on('table1')->onDelete('cascade');
$table->foreign('table2_id')->references('id')->on('table2')->onDelete('cascade');
});
...
}
public function down()
{
...
Schema::table('table1_table2', function(Blueprint $table)
{
$table->dropForeign('table1_id');
$table->dropForeign('table2_id');
});
...
}
Run Code Online (Sandbox Code Playgroud) 部署我的新弹性 beanstalkNode.js 12 running on 64bit Amazon Linux 2/5.2.2应用程序时,运行后出现错误$ eb deploy myapp-staging-env:
2020-10-17 19:57:56 INFO Environment update is starting.
2020-10-17 19:58:22 INFO Deploying new version to instance(s).
2020-10-17 19:58:49 ERROR Instance deployment failed. For details, see 'eb-engine.log'.
2020-10-17 19:58:49 ERROR [Instance: i-034b2f1000000] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
2020-10-17 19:58:49 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-10-17 19:58:49 ERROR Unsuccessful command execution …Run Code Online (Sandbox Code Playgroud) 是否可以传入数组值?
test ([1, 2, 3, 4]);
Run Code Online (Sandbox Code Playgroud)
public void test(int[] foo) {
for (int i : foo) {
System.out.println(i);
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
1
2
3
4
Run Code Online (Sandbox Code Playgroud)