function TrainHead($sdata,$edata){
$lastmin = (strtotime($edata["AllTime"])-strtotime($sdata["AllTime"]))/60;
$lasthour = (int)($lastmin / 60);
$lastmin %= 60;
$lasttime = $lasthour."Сʱ".$lastmin."·ÖÖÓ";
?>
……本人完全不懂脚本语言,但是数据库实验要求写页面,而且这星期就要交报告。这段网上找的代码也不知道哪里出错了,显示:
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 15
class=info train=
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 15
>
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 19
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 23
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 26-
Notice: Undefined variable: edata in C:\xampp\htdocs\showdata.php on line 26
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 29
Notice: Undefined variable: edata in C:\xampp\htdocs\showdata.php on line 32
Notice: Undefined variable: lasttime in C:\xampp\htdocs\showdata.php on line 35
……
不懂啊,求大神帮忙啊,到底怎么改才对,谢谢啦~~~~
回复讨论(解决方案)
请贴出完整的代码,变量属性未定义。
请贴出完整的代码,变量属性未定义。
下面是全部showdata.php代码。这个showdata.php是用require("showdata.php")再嵌到traindata.php中的。谢谢帮忙!
function TrainHead($sdata,$edata){
$lastmin = (strtotime($edata["AllTime"])-strtotime($sdata["AllTime"]))/60;
$lasthour = (int)($lastmin / 60);
$lastmin %= 60;
$lasttime = $lasthour."Сʱ".$lastmin."·ÖÖÓ";
?>
- class=info train==$sdata["TrainNum"]?>>
-
-
">=$sdata["TrainNum"]?>
-
=$sdata["Type"]?>
-
=$sdata["Station"]?>-=$edata["Station"]?>
-
=$sdata["StartTime"]?>
-
=$edata["ArriveTime"]?>
-
=$lasttime?>
-
=($edata["AllMile"] - $sdata["AllMile"])?>¹«Àï
-
£¤=($edata["AllPrice"] - $sdata["AllPrice"])?>
-
" traintype="=$sdata["Type"]?>" startstation="=$sdata["Station"]?>" arrivestation="=$edata["Station"]?>" starttime="=$sdata["StartTime"]?>" arrivetime="=$edata["ArriveTime"]?>" price="=($edata["AllPrice"] - $sdata["AllPrice"])?>" mile="=($edata["AllMile"] - $sdata["AllMile"])?>">¹ºÂò
class=" orario">
Õ¾´Î | Õ¾Ãû | µ½´ïʱ¼ä | ¿ª³µÊ±¼ä | ÔËÐÐʱ¼ä | Àï³Ì | Ʊ¼Û |
---|---|---|---|---|---|---|
=$row1["Order"]?> | =$row1["Station"]?> | =$row1["ArriveTime"]?> | =$row1["StartTime"]?> | =$lasttime?> | =($row1["AllMile"] - $startdata["AllMile"])?>¹«Àï | =($row1["AllPrice"] - $startdata["AllPrice"])?> |
È«²¿Àï³Ì: | =($row1["AllMile"] - $startdata["AllMile"])?>¹«Àï | È«³Ìʱ¼ä: | =$lasttime?> | È«³ÌƱ¼Û: | =($row1["AllPrice"] - $startdata["AllPrice"])?>Ôª |
}
function UserTicketList($query){
$allrows = mysql_num_rows($query);
for($i=0;$i $data = mysql_fetch_assoc($query);
?>
- class=info train==$data["TrainNum"]?>>
-
-
">=$data["TrainNum"]?>
-
=$data["Type"]?>
-
=$data["StartStation"]?>-=$data["ArriStation"]?>
-
=$data["StartTime"]?>
-
=$data["ArriTime"]?>
-
=$data["Date"]?>
-
=$data["Mile"]?>¹«Àï
-
=$data["Car"]?>³µ =$data["Position"]?>ºÅ
-
=$data["Price"]?>
-
">ɾ³ý
}
}
function UserInformation($query){
$data = mysql_fetch_assoc($query);
?>
}
?>
php都是这样的
<?php 语句; ?>
php都是这样的
<?php 语句; ?>
哦,好吧,问了个同学,他说这里面有js,代码太复杂了。Thank you!
看提示明显是变量没有定义。
function TrainHead( $sdata,$edata){
调用这个方法时,没有传$sdata这个参数,可以检查调用这个方法的语句。