我用PHP生成一些内容,但是当内容的数量超过5时,高度变得大于div的高度,所以我不希望它堆叠在div的顶部,而是移动到右边的div div从顶部开始.这是一张图片.

PHP
echo '<a class="LibSectOpen">
<span style="display:none" class="SectionName">'.$Section.'</span>
<div class="LibrarySects"><div class="LibrarySectsHeader">'.$Section.'</div>
<div class="LibrarySectsShelf">';
while($row = mysql_fetch_array($log2)){
echo '<div class="LibrarySectsShelf_Book" style="background-color:'.$Color.'"
title="Author: '.$row['bbookauthor'].'">'.$row['bbookname'].'</div>';
}
echo ' </div>
</div>
</a>';
Run Code Online (Sandbox Code Playgroud)
看起来,这个例子中的哲学书落了下来,我希望它向右走,然后开始另外一列五本书等等.
我可以用JQuery和CSS做任何想法吗?
.LibrarySectsHeader {
border:1px #CCC solid;width:500px; margin:2px; padding:1px; height:18px;border-radius:2px 2px 2px 2px; font-size:10px; color:rgba(0,0,0,1) !important; background-color: rgba(255,255,255,0.6); line-height:18px;
}
.LibrarySectsShelf {
border:1px #CCC solid;width:499px; margin:2px; padding:1px; height:129px;border-radius:2px 2px 2px 2px; font-size:10px; background-color: rgba(255,255,255,0.2); line-height:18px; background-image:url(images/bg/wood.jpg); background-size:100%; background-repeat:no-repeat;
}
.LibrarySectsShelf_Book {
border:1px #C90 solid;width:148px;height:23px; margin-bottom:1px;border-radius:3px 3px 3px 3px; font-size:10px; background-color: rgba(51,153,255,0.9); …Run Code Online (Sandbox Code Playgroud) 我正在使用mysqli_fetch_array并且计数是正确的,直到我更改为fetch(),现在只返回总行数而不是返回每行的每个数字.
所以对于第一行,我想回显"1",依此类推.
新注意:while语句中的所有其他内容都返回正确的值,但计数器返回总行数,而我想要按照从sql语句中选择的顺序排序.
按照要求.这是我的联系.
我不知道我是否想要检查"$ e-> getMessage();" 因为我在所有查询中使用此连接,所以在每个查询上.
try {
$dbh = new PDO('mysql:host=localhost;dbname=my_db;charset=utf8', 'usr', 'pwd',
array(PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
);
} catch (PDOException $e){
echo $e->getMessage();
}
Run Code Online (Sandbox Code Playgroud)
这很有效
$query = mysqli_query($con, 'SELECT * FROM music');
$count = 0;
while($row = mysqli_fetch_array($query)){
$count++;
echo $count;
}
Run Code Online (Sandbox Code Playgroud)
新的不起作用.
$query = $dbh->query('SELECT * FROM music');
$count = 0;
while($row = $query->fetch()){
$count++;
echo $count;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试收集Facebook用户信息,然后进行签名.我如何在ajax中包含多个值?
$.signuser = function () {
FB.api('/me', function (response) {
var str = "";
alert(response.name);
var fbfname = response.first_name;
var fblname = response.last_name;
var fblname = response.id;
var fblink = response.link;
var fbusername = response.username;
var fblink = response.email;
$.ajax({
type: "POST",
data: {
data: fbfname,
fblname
},
complete: function () {
//$('#booksloadjif').css('display','none')
},
url: "fbpost.php"
}).done(function (feedback) {
$('#fg').html(feedback)
});
});
}
Run Code Online (Sandbox Code Playgroud) 我想检查用户是否输入了接近有效名称的内容.所以,如果输入类似的内容gbcvcvrt,我想验证它并将其标记为不是真名.类似的东西theg+vowel应该被验证为正确的名称.
在任何长度的字符串上,代码应该检测四个连续的非元音字母表.我不希望任何人的名字顺便说一下
考虑
$String = 'therhythm';
Run Code Online (Sandbox Code Playgroud)
我们无法检查前四个字符,我们必须遍历整个字符串并检查四个连续的四个非元音字母表,无论它们位于字符串的哪个位置.这样我们就可以验证$ String是无效的,即使前五个字符会验证它,如果我们检查前四个字母表.
我使用Mobile-Detect库来检测某些移动设备并更改为移动设备,iOS工作正常,但三星galaxy S4未被检测到,
PHP
require_once 'php/Mobile_Detect.php';
$detect = new Mobile_Detect;
if ($detect->isMobile()){
include_once 'php/header-full.php';
} else {
include_once 'desktop.php';
}
Run Code Online (Sandbox Code Playgroud)
Mobile_Detect版本2.7.6. 测试现场.
我正在使用以下代码上传一些文件,但是,有些文件被取代,因为这些名称相似.我只是想知道如何更改名称,我试过但我发现自己弄乱了整个代码.
PHP
if (!empty($_FILES["ambum_art"])) {
$myFile = $_FILES["ambum_art"];
if ($myFile["error"] !== UPLOAD_ERR_OK) {
echo "<p>An error occurred.</p>";
exit;
}
$name = preg_replace("/[^A-Z0-9._-]/i", "_", $myFile["name"]);
$i = 0;
$parts = pathinfo($name);
while (file_exists(UPLOAD_DIR . $name)) {
$i++;
$name = $parts["filename"] . "-" . $i . "." . $parts["extension"];
}
$success = move_uploaded_file($myFile["tmp_name"],UPLOAD_DIR . '/'.$name);
if (!$success) {
echo "<p>Unable to save file.</p>";
exit;
} else {
$Dir = UPLOAD_DIR .'/'. $_FILES["ambum_art"]["name"];
}
chmod(UPLOAD_DIR .'/'. $name, 0644);
unset($_SESSION['video']);
$_SESSION['album_art'] = $Dir;
$ambum_art_result …Run Code Online (Sandbox Code Playgroud) 我有一些像这样的div.
<div class"parent">
<div class"child">
Some Stuff Here
</div>
</div>
<div class"parent">
<div class"child">
Some other kinda Stuff Here
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我想单击父类并仅在该父级内显示子类,而不显示其他父类中的其他子类.
$(document).on('click', '.parent', function(){
$(this).find($('.child').show(500));
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试学习套接字时使用以下代码作为套接字服务器,但客户端代码将工作一次,我必须在运行clint代码之前每次运行服务器脚本.
所以我什么时候运行这个server.php来继续监听客户端请求?
SERVER.PHP
$host = "127.0.0.1";
$port = 25003;
set_time_limit(0);
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
$result = socket_listen($socket, 3) or die("Could not set up socket listener\n");
$spawn = socket_accept($socket) or die("Could not accept incoming connection\n");
$input = socket_read($spawn, 1024) or die("Could not read input\n");
if ($input == "Hey"){
$input = "Hey you don't shout me. Talk properly...";
} else if ($input == "Vetra"){
$input …Run Code Online (Sandbox Code Playgroud) php ×7
javascript ×3
jquery ×3
ajax ×1
char ×1
children ×1
connection ×1
counter ×1
css ×1
file ×1
html ×1
mobile ×1
mysql ×1
parent-child ×1
pdo ×1
port ×1
preg-match ×1
preg-replace ×1
random ×1
regex ×1
sockets ×1
sql ×1
timestamp ×1
upload ×1