数据库不加载内容,它显示代码行,如何解决

时间:2017-04-10 21:16:12

标签: php html mysql database

我没有html和css的问题,我会解决它们,但在我的屏幕上他们不显示数据库的内容,但是代码行

连接数据库:

mysql_connect("sth.gr", "sth", "sth123")or die("cannot connect");
mysql_select_db("sth");
mysql_query("set names 'utf8'");

$today=date("Y-m-d");

SQL查询

$sql = "SELECT FLINES.FLINES,
       LMAST.NAME,
       FDOC.FDOC,
       FLINES.COMMENTS AS FLCOMMENTS,
       FLINES.QTY1,
       SUBSTRING(FDOC.TRNDATE,1,10) AS TRNDATE,
       FLINES.SE1_START,
       TIMESTAMPDIFF(MINUTE,SE1_START,SE1_END) AS DIFERENCE
FROM FLINES
INNER JOIN FDOC ON FDOC.FDOC=FLINES.FDOC
INNER JOIN LMAST ON LMAST.LMAST=FDOC.LMAST
INNER JOIN SMAST ON SMAST.SMAST=FLINES.SMAST
WHERE TRNDATE >= '$today'
  AND SMAST.U_SE1='true'
  AND FLINES.SE1_END IS NULL
ORDER BY TRNDATE,
         FDOC,
         FLINES
";

我将查询放在变量中以获取

上面的每一行
$stmt = mysql_query( $sql );
if ($stmt->connect_error) {
    die("Connection failed: " . $stmt->connect_error);
}

上面的结果我将用html和css设置样式,我将创建一个包含所有这些的表

while($row = mysql_fetch_array($stmt)) {
    if ($temp_FDOC!=$row[FDOC]) { 
        echo $row[NAME];            
        $j=0; 
    }
    echo $j=$j+1; 
    echo $row[FLCOMMENTS]; 
    echo $row[QTY1]; 

以下是一些按钮

    if($row[SE1_START]==NULL) { 
        echo '<button name="flines_id_start" value="<? echo $row[FLINES];?>" type="submit">ΞΕΚΙΝΑΩ</button>';
    } else {
        echo '<button name="flines_id_end" value="<? echo $row[FLINES];?>" type="submit">ΕΤΟΙΜΟ</button>';
        echo '<button name="flines_id_again" value="<? echo $row[FLINES];?>" type="submit">ΕΠΑΝΕΚΚΗΝΙΣΗ</button>';
    } 
    $temp_FDOC=$row[FDOC];
};

mysql_free_result( $stmt);

0 个答案:

没有答案