php - 注意 : Undefined variable: today and tomorrow(Variable's) in . 。在第 6 行

标签 php mysql

我想将 $today$tomorrow 添加到我的 mysql,但它有 Notice 错误。 当我使用这种格式时,它正在工作:'2013-10-04'。

这是我的代码:

<?php
$date = "";
$saat = "";
$sql = "SELECT * FROM calendar  WHERE starttime >= '$today' AND starttime < '$tomorrow' and username= '$user' order by starttime ASC  ";
 $result = mysqli_query($db_conx, $sql); 

while($row = mysqli_fetch_array($result))
  {
  $date =  $row['StartTime']."<br />";
  $date = date("j F Y ", strtotime($row['StartTime']));
  $saat = date("H", strtotime($row['StartTime']));
  echo $date . "At  " . $saat."<br />";
  }
?>

这是我想用于约会的代码:

<?php
    $tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
    echo "Tomorrow is ".date("Y-m-d", $tomorrow). "<br />";
    $today = date("Y-m-d");
    echo "Today is " .$today . "<br>";
  ?>

我需要做什么?谢谢。

最佳答案

在顶部的上述文件中包含以下文件。

语法:

include("file_name.php");

您还可以使用 require:

require("path_to_file/file_name.php");

然后你就可以在上面的文件中使用下面文件的变量了。

关于php - 注意 : Undefined variable: today and tomorrow(Variable's) in . 。在第 6 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19179467/

相关文章:

php - 查询表以根据通过 php 中的 url 传递的相册 ID 检索图像信息

mysql - DATE_FORMAT 与字符串和数字进行比较

mysql - 选择在另一个表中查找名称

mysql - sql group_concat 和子查询

c# - UWP、MySQL、填充ListView、实现CRUD操作

php - Cgridview 'filter' 属性出错,错误代码::没有方法 'querystring'

php - 使用 JavaScript 更改元素 ID

php - 使用 mysql 组合列和样条 Highcharts

php - MySQL 查询给出错误 : unexpected T_CONSTANT_ENCAPSED_STRING

mysql - pg_query_params 在 mysql 中等效?