我对mysqli准备好的陈述很新,其实这是我第一次尝试它.我有这个代码块,我把echos放在每个命令之间,它显示aaa和bbb但不是ccc,我在这里做错了什么?
没有错误出现,只是一个空白屏幕:
<?php
$mysqli = new mysqli("localhost", "username", "password", "database");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT title FROM `in-the-press`")) {
$stmt->execute();
echo 'aaa';
$stmt->bind_result($title);
echo 'bbb';
$result = $stmt->get_result();
echo 'ccc';
while ($stmt->fetch()) {
printf("%s %s\n", $title);
}
echo 'ddd';
$stmt->close();
}
$mysqli->close();
?>
Run Code Online (Sandbox Code Playgroud)
更新通过执行以下操作,我能够实现此功能:
<?php
$mysqli = new mysqli("localhost", "username", "password", "database");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT id, community, map, image FROM `googleMaps`")) …Run Code Online (Sandbox Code Playgroud) 我有这样的复选框:
<ul id="searchFilter">
<li><input type="checkbox" name="price[]" class="cb_price" value="1"> $200,000 to $299,999</li>
<li><input type="checkbox" name="price[]" class="cb_price" value="3"> $300,000 to $399,999</li>
<li><input type="checkbox" name="price[]" class="cb_price" value="5"> $400,000 to $499,999</li>
<li><input type="checkbox" name="price[]" class="cb_price" value="8"> $500,000+</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我如何提醒价格[]以查看检查的内容?我在jquery很新:(
我在这里有这个代码:
$imagePreFix = substr($fileinfo['basename'], strpos($fileinfo['basename'], "_") +1);
这得到了我在下划线之后的所有内容,但我希望在下划线之前得到所有内容,我将如何调整此代码以获得下划线之前的所有内容?
$fileinfo['basename'] 等于'feature_00'
谢谢
我有3个div叫做.pageSection,我有一个jquery,每个隐藏每个项目,但我不想隐藏第一个项目,我该怎么做?我尝试了以下,仍然拥有所有项目,没有错误:
$('.pageSection').each(function(){
if($(this).not(":eq(0)")){
$(this).hide();
}
});
Run Code Online (Sandbox Code Playgroud) 我与几个复选框name="location[]"和每个复选框具有不同的值value="3"或者value="5"等我想知道如何在jQuery中,当这些复选框被选中把数组里面的值称为location[]?这是我的HTML:
<ul id="searchFilter">
<li class=""><input type="checkbox" name="location[]" class="cb_location" value="1">Toronto</li>
<li class=""><input type="checkbox" name="location[]" class="cb_location" value="3">New York</li>
<li class=""><input type="checkbox" name="location[]" class="cb_location" value="6">London</li>
<li class=""><input type="checkbox" name="location[]" class="cb_location" value="5">Paris</li>
<li class=""><input type="checkbox" name="location[]" class="cb_location" value="4">Berlin</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
以及我到目前为止得到的东西:
var $checkboxes = $("input:checkbox");
var opts = [];
$checkboxes.each(function(){
if(this.checked){
opts.push(this.name);
}
Run Code Online (Sandbox Code Playgroud)
当我检查另一个项目时,这会返回location[]并添加另一个location[].
请帮忙.
我还有其他复选框,价格[],sqft [] ...我希望保持复选框在同一个地面,所以数组在1个数组...我希望这是有道理的.
我有这个条件,我想要做的就是说,如果$ _GET ['subpage']不等于registerupcoming那么这样做,但是我得到一个错误:
注意:未定义索引:26行/Applications/XAMPP/xamppfiles/htdocs/losanihomes/views/includes/header.php中的子页面
所以我尝试了以下方法:
if(isset($_GET['subpage']) && $_GET['subpage'] != 'registerupcoming'){
//Do Something
}
Run Code Online (Sandbox Code Playgroud)
但问题是,如果没有设置子页面,那么它不会进入条件,我只想不进入这个条件,如果子页面不等于registerupcoming
javascript ×3
jquery ×3
php ×3
checkbox ×1
each ×1
if-statement ×1
mysqli ×1
string ×1
strpos ×1
substr ×1