第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

使用 date_format() 函數(shù),mysql 數(shù)據(jù)庫中的日期未顯示在 html 表中

使用 date_format() 函數(shù),mysql 數(shù)據(jù)庫中的日期未顯示在 html 表中

慕哥9229398 2023-08-29 18:28:19
我有這段 HTML 代碼:if($_GET["disp"]){    include 'config.php';    $searchstr=$_GET['cname'];    $sql="select cname, date_format(podate, '%d-%m-%Y'), started, reason, date_format(tentdate, '%d-%m-%Y'), progress, status from info where cname='$searchstr';";    $result=mysqli_query($conn, $sql);    if($searchstr==""){    $message="Please enter a customer name";    echo "<script type='text/javascript'>alert('$message');     window.location.href='retreive.php';</script>";}else{    echo "<table id='info' border='1px solid black'><tr padding='2'><th>Customer Name</th><th>Purchase Order Date</th><th>Started?</th><th>Reason (If any)</th><th>Tentative start date</th><th>Progress</th><th>Current Status</th><th>New status</th></tr>";    while ($row = $result->fetch_assoc()) {        $cname=$row['cname'];        $podate=$row['podate'];        $started=$row['started'];        $reason=$row['reason'];        $tentdate=$row['tentdate'];        $progress=$row['progress'];        $status=$row['status'];        echo "<tr><td>".$cname."</td><td>".$podate."</td><td>".$started."</td><td>".$reason."</td><td>".$tentdate."</td><td>".$progress."</td><td>".$status."</td><td><select id='status' name='status'>    <option value='L1 Ongoing'>L1 Ongoing</option>    <option value='L1 Complete'>L1 Complete</option>    <option value='L2 Ongoing'>L2 Ongoing</option>    <option value='L2 Complete'>L2 Complete</option>    <option value='Invoice'>Invoice</option></select></td></tr>";    }    echo "</table><br>";}}此代碼從數(shù)據(jù)庫檢索數(shù)據(jù)并將其顯示在 HTML 表中。除日期外,所有內(nèi)容都會(huì)顯示。不過,當(dāng)我在 MySQL 命令行中運(yùn)行查詢時(shí),它工作正常,并且也以所需的格式顯示日期。唯一不顯示的地方是 HTML 表格中。我需要知道我做錯(cuò)了什么。以下是分別在 HTML 表和 SQL 表中的表輸出:html表 sql表
查看完整描述

1 回答

?
四季花海

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超5個(gè)贊

您正在使用date_format該列上的函數(shù)。

結(jié)果鍵將被稱為類似但您正在代碼中date_format(podate, '%d-%m-%Y')檢查的名稱。podate

給它一個(gè)別名podate,一切都很好。

例如

... date_format(podate, '%d-%m-%Y') AS podate ....


查看完整回答
反對 回復(fù) 2023-08-29
  • 1 回答
  • 0 關(guān)注
  • 183 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)