我想获得通过$ _GET提交的值的数量.我将使用for循环,每7个将被保存到一个类.有谁知道如何找到$ _GET数组的Size_of?我查看了这个信息$ _GET手册,但看不到我在找什么.
这是我在提交后去的课程中开始的代码片段.
for($i=0;$i<$_GET<size>;$i++) {
$ID = $_GET["ID"][$i];
$Desc = $_GET["Desc"][$i];
$Yevaluation = $_GET["Yevaluation"][$i];
$Mevaluation = $_GET["Mevaluation"][$i];
$Cevaluation = $_GET["Cevaluation"][$i];
$Kevaluation = $_GET["Kevaluation"][$i];
$comment = $_GET["comment"][$i];
//saving bunch to class next
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用index.html来使用此脚本:
<form action="upload.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Upload" />
</form>
Run Code Online (Sandbox Code Playgroud)
要通过连接到这个(称为upload.php)上传mp3文件:
<?php
if ((($_FILES["file"]["type"] == "audio/mp3") //File type
|| ($_FILES["file"]["type"] == "audio/mp3"))
&& ($_FILES["file"]["size"] < 21000000) //20MB File Size
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "";//another echo to display after upload is complete
if (file_exists("mp3/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else …Run Code Online (Sandbox Code Playgroud) 我有使用Ternory Operator方法选择selectbox的代码:
Ternary operator let us return one of two values based on a given condition. It’s syntax is like below.
(expression)?(if expression is true):(if expression is false)
Run Code Online (Sandbox Code Playgroud)
mycode的:
<select class="form-control contentgroup input-sm" name="access">
<option value="1" <?php echo ($access = 1) ? 'selected' : ''; ?>>1</option>
<option value="2" <?php echo ($access = 2) ? 'selected' : ''; ?>>2</option>
<option value="3" <?php echo ($access = 3) ? 'selected' : ''; ?>>3</option>
</select>
Run Code Online (Sandbox Code Playgroud)
但我输出我看到所有选项都被选中:
<select class="form-control contentgroup input-sm" name="access">
<option value="1" selected>1</option> …Run Code Online (Sandbox Code Playgroud) 我需要将当前日期与开始日期进行比较,想法是每个月+ 1天它将返回,好像只有一个月过去了.因此,如果开始日期是2014-10-27,那么在2014-11-27它仍将显示不到一个月前,并且在2014-11-28它将显示一个多月前.
目前我有:
$start_datetime = '2014-10-27';
// true if my_date is more than a month ago
if (strtotime($start_datetime) < strtotime('1 month ago')){
echo ("More than a month ago...");
} else {
echo ("Less than a month ago...");
}
Run Code Online (Sandbox Code Playgroud) 我尝试使用查询来查找此查询的用户:
Select id, username, lat, long,
acos(sin(0.761312289853)*sin(radians(lat)) + cos(0.761312289853)*cos(radians(lat))*cos(radians(long)-0.0676354285243)) * 6371 As D
From (
Select id, username, lat, long,
From rcp_users
Where lat Between 43.4491099949 And 43.7908522051
And long Between 3.63919239657 And 4.11125680343
) As FirstCut
Where acos(sin(0.761312289853)*sin(radians(lat)) + cos(0.761312289853)*cos(radians(lat))*cos(radians(long)-0.0676354285243)) * 6371 < 30
Order by D
Run Code Online (Sandbox Code Playgroud)
但我有这个错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'long,
acos(sin(0.761312289853)*sin(radians(lat)) + cos(0.761312289853)*' at line …Run Code Online (Sandbox Code Playgroud) 我有一个数组,我需要循环并改变它的值:
foreach ($input['qualification'] as &$_v) {
$_v = ucwords($_v);
}
Run Code Online (Sandbox Code Playgroud)
但这仅适用于数组中的第一项.当我删除&符号时,它会循环遍历整个数组,但显然没有进行更改.
我正在尝试编写这样的查询(希望只有一个查询):从收件箱表中选择所有消息,其中消息的“SenderNumber”位于“Sentitems”表中,并且 CreatorID 为“Martin”
例如我的收件箱表如下所示:
| SenderNumber | TextMessage |
11111111 Yes, nice world!
22222222 Howdy folks!
Run Code Online (Sandbox Code Playgroud)
我的Sentites表看起来非常相似
| DestinationNumber | TextMessage | CreatorID
11111111 Hello world? Martin
22222222 How you do? John
Run Code Online (Sandbox Code Playgroud)
我想在这种情况下从收件箱表中获取所有消息 -在我的Sentitems表中有一个“SenderNumber”/“DestinationNumber”条目,并且CreatorID是“Martin”。
因此,在这种情况下,它将返回此条目,因为另一个号码的 CreatorID 不是“Martin”而是“John”
| SenderNumber | TextMessage |
11111111 Yes, nice world!
Run Code Online (Sandbox Code Playgroud) 我想输入并用“,”分割所有输入。
例如输入是:
Hello World
Run Code Online (Sandbox Code Playgroud)
我想将其转换为:
H,e,l,l,o,W,o,r,l,d
Run Code Online (Sandbox Code Playgroud) 我试图在已打开的echo函数中添加if/else语句,但页面显示为空白.如果我正确连接,不太确定.
echo '<span class="year-tab-'.$x.' '.if ($single_year==$year_selected) { echo "" } else { echo "display-none" }.' ">';
Run Code Online (Sandbox Code Playgroud) 我想打印一个日期格式,如:Sun, 08 Mar 2015 14:54:54
我使用的功能,date("r");但输出是:Sun, 08 Mar 2015 14:54:54 +0100
如何删除部分+0100?
php ×8
arrays ×2
date ×2
sql ×2
string ×2
date-math ×1
for-loop ×1
get ×1
if-statement ×1
mysql ×1
python ×1
split ×1
superglobals ×1
syntax-error ×1