小编Xri*_*iuk的帖子

MYSQL IF value = null OR value =""

我有这部分查询:

IF(orders = NULL OR orders = '', "value1', 'value2')
Run Code Online (Sandbox Code Playgroud)

哪个适用于空单元格,但不适用于空单元格,任何帮助?当它为NULL时它不会产生任何东西,只有当它''它运行查询时

mysql

2
推荐指数
1
解决办法
135
查看次数

MySQL FIND_IN_SET()没有按预期工作

我有下表:

... | parents_id   | ...
________________________
... | 1, 40, 7     | ...
... | 10, 4, 7, 1  | ...
... | 45, 40, 1, 7 | ...
... | other_rows   | ...
Run Code Online (Sandbox Code Playgroud)

现在,我需要获取这三行,我使用此查询SELECT * FROM products WHERE FIND_IN_SET(1, parents_id) > 0,但我只得到第一行(1, 40, 7),任何帮助?

mysql

2
推荐指数
1
解决办法
1296
查看次数

Javascript onclick autotriggering

我有这个代码:

var bt_empty = document.getElementById("bt_empty");
if(bt_empty)
  bt_empty.onclick = emptyCart();
Run Code Online (Sandbox Code Playgroud)

但每次打开页面时,按钮都会自动触发.我怎么能避免这种情况?谢谢

javascript onclick

1
推荐指数
1
解决办法
37
查看次数

Div具有动态宽度和水平滚动条

我有这个代码:

<div style="height:190px;width:1000px;white-space:nowrap;overflow:auto;table-layout:fixed">
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album1.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 1 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album2.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 2 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album3.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 3 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album1.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 1 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album2.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 2 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album3.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 3 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album1.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 1 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album2.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 2 (2,99€)</a>
    <a style="width:150px;display:inline-block;margin-right:10px;font-weight:bold" href="#"><img src="album3.jpg" style="width:150px;height:150px;margin-bottom:2px"><br>Album 3 (2,99€)</a>
</div>
Run Code Online (Sandbox Code Playgroud)

这基本上是带有水平滚动条的固定宽度DIV,我需要做的是使其宽度适应父元素(表格单元格).通过设置宽度:100%它会溢出父容器并且滚动条消失,我该怎么办?

谢谢

html javascript css

1
推荐指数
1
解决办法
1925
查看次数

字符串中的PHP变量

我有这个小代码:

$a = "apple";
$var = "I like the $a";
echo $var;
echo "<br>";
$a = "pear";
echo $var;

OUTPUT:
I like the apple
I like the apple

OUTPUT I NEED:
I like the apple
I like the pear
Run Code Online (Sandbox Code Playgroud)

任何人都知道如何动态更新字符串中的var?
谢谢

php

0
推荐指数
1
解决办法
82
查看次数

标签 统计

javascript ×2

mysql ×2

css ×1

html ×1

onclick ×1

php ×1