頁面指令碼 php 求教

來源:互聯網
上載者:User


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=>



  • ">






  • -











  • ¹«Àï


  • £¤


  • " traintype="" startstation="" arrivestation="" starttime="" arrivetime="" price="" mile="">¹ºÂò



class=" orario">
























































} function TrainDetailList($data,$st,$ed){ mysql_data_seek($data,$st); for($j = $st; $j < $ed;$j++){ $row1 = mysql_fetch_assoc($data); if($j == $st){ //start station $startdata = $row1; } $lastmin = (strtotime($row1["AllTime"])-strtotime($startdata["AllTime"]))/60; $lasthour = (int)($lastmin / 60); $lastmin %= 60; $lasttime = $lasthour."Сʱ".$lastmin."·ÖÖÓ"; ?> } ?>
Õ¾´Î Õ¾Ãû µ½´ïʱ¼ä ¿ª³µÊ±¼ä ÔËÐÐʱ¼ä Àï³Ì Ʊ¼Û
¹«Àï













È«²¿Àï³Ì: ¹«Àï È«³Ìʱ¼ä: È«³ÌƱ¼Û: Ôª









}

function UserTicketList($query){
$allrows = mysql_num_rows($query);
for($i=0;$i<$allrows;$i++){
$data = mysql_fetch_assoc($query);
?>

    class=info train=>



  • ">






  • -











  • ¹«Àï


  • ³µ ºÅ





  • ">ɾ³ý



}
}


function UserInformation($query){
$data = mysql_fetch_assoc($query);

?>

}
?>

php都是這樣的

php都是這樣的


哦,好吧,問了個同學,他說這裡面有js,代碼太複雜了。Thank you!

看提示明顯是變數沒有定義。

function TrainHead( $sdata,$edata){

調用這個方法時,沒有傳$sdata這個參數,可以檢查調用這個方法的語句。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.