Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php和mysql。查看主题日期_Php_Mysql - Fatal编程技术网

php和mysql。查看主题日期

php和mysql。查看主题日期,php,mysql,Php,Mysql,我可以为期末考试指定的讲师创建一个网站论坛。 现在我的编码有一个问题。 请修理 创建主题/线程时,我们打开了主题/threadnya,有一个日期告诉我们主题/线程何时创建。 但是在我的代码中,显示数据库中所有现有的日期 <?php session_start(); if($_SESSION['logged'] == true) { if(isset($_SESSION['username'])) { echo $username=$_SESSION["usern

我可以为期末考试指定的讲师创建一个网站论坛。 现在我的编码有一个问题。 请修理

创建主题/线程时,我们打开了主题/threadnya,有一个日期告诉我们主题/线程何时创建。 但是在我的代码中,显示数据库中所有现有的日期

    <?php
session_start();
if($_SESSION['logged'] == true)
{
    if(isset($_SESSION['username']))
    {   echo $username=$_SESSION["username"];
    }else
    {
    header('Location:login.php');
    }
}
?>



<!DOCTYPE html>
<html>
<head>

<!==CSS>
<style>
#clock{
pointer-events: none
}
</style>
<!close css>

<img src="head1.jpg" alt="icon" width="100%" height="110">
<img src="line1.jpg" alt="icon" width="100%" height="20">
<title>Venray</title>
<body background="alienbackground.jpg">
<font face="comic sans MS">
<!==Table Login==>
<table border="0" style="width:99%" bgcolor="#424242" align="center">
<tr>
    <table border="0" style="width:98%" bgcolor="#424242" align="center">
    <tr>
        <td> <img src="start.gif" alt="icon" width="26" height="26">   </td>
            <td rowspan="2" align="right">
                <table border="0" bgcolor="#2E2E2E">

                <tr>
                    <td><b> 
<?php 
{
    echo "<tr><td><b><font color=green> Welcome, ";
    echo $username;
    echo '<a href="logout.php" style="text-decoration:none; color:red;"><span>, [Log Out]</span></a></li>';
    echo "</tr></td></b></font>";
    }
?>

                    </b></td>
                </tr>

                <tr>
                    <td id=clock align="right"><b><iframe src="http://free.timeanddate.com/clock/i4eh41xm/n108/tlsg/fn7/fs12/tct/pct/ftb/tt0/tw1/tm1/th1" frameborder="0" width="182" height="20" allowTransparency="true"></iframe>
</b></td>
                </tr>
                </table>
            </td>   
    </tr>
        <tr>
            <td valign="top"><b><font size="4">Community</font></b></td>
        </tr>
    </table>
</tr>


<p style="color:#ff0000">

<!==Table please welcome==>
<table border="0" style="width:98%" bgcolor="#424242" align="center">

    <tr>
        <td align="right">
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
require("conn.php");
$con = mysql_connect($server,$user,$pass);
$db = mysql_select_db($db);
$sql = "select * from d_admin order by username";
//echo $sql;
$ambil_data = mysql_query($sql);
while($data = mysql_fetch_array($ambil_data))
$result = mysql_query("SELECT * FROM d_admin");
$rows = mysql_num_rows($result);
echo "Member " . $rows . " * ";
?>
        Post 1 * Topics 1 </td>
    </tr>
</table>
<br>
<table border="1" width="98%" height="6%" align="center" bgcolor=#424242 >
    <tr>
        <td align="left" ><a href="forumuser.php"><img src="hometopic.gif" width="40" height="40"></a> </td>
    </tr>


    <tr>
        <table border="1" width="98%" height="40" align="center" bgcolor="#86B404" bordercolor=green>
        <tr>

        <th width="70%" align="left"><img src="open.png" width="40" height="40">Posting Display</th>
        <td align="right"><a href="replay"><img src="replay.png" width="150" height="40"></a></td>
        </tr>
    </tr>

        <tr>

            <table border="1" width="98%" height="70" align="center" bgcolor=#424242>


***<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$con = mysql_connect($server,$user,$pass);
$db = mysql_select_db($db);
$sql = "select * from tabel_topik ";
$ambil_data = mysql_query($sql);
while($data = mysql_fetch_array($ambil_data))
{
    echo '<tr><th align="left" valign="top" colspan="2" >'.$data['date'].'</th></tr>';
    echo '</tr>';
} 
?>***   


            <tr><th align="center" width="15%">Venray</th><td align="left" width="85%">title</td></tr>
            <tr><th align="top" width="15%">join dates</th><td align="left" rowspan="2" valign="top">awd</td></tr>
            <tr><th align="center" valign="top" width="15%" height="400">9 Post</th></tr>
            <tr>
            <td align="left">*</td>
            <td align="right" width="85%"><a href=""><img src="replay.png" width="150" height="40"></a></td></tr>
            </table>
        </tr>
</table>
</body>
</font>
</head>
</html>

#钟{
指针事件:无
}
文瑞
社区

帖子1*主题1
张贴展示 ****** 文莱头衔 连接日锯 9个职位 *


通过向初学者传递ID或查询中的任何类似字段来获取特定于论坛的数据。然后,如果希望格式化日期的显示方式,可以使用php date函数,如下所示:

while($data = mysql_fetch_array($ambil_data))
{
    echo '<tr><th align="left" valign="top" colspan="2" >'.date('jS M, Y',strtotime($data['date'])).'</th></tr>'; //format the date as required
    echo '</tr>';
}
while($data=mysql\u fetch\u数组($ambil\u data))
{
echo'.date('jS M,Y',strotime($data['date'])。';//根据需要格式化日期
回声';
}

您正在从数据库获取所有数据并运行while循环,为每个日期添加一个while循环。你需要运行特定于该论坛的查询。但我不知道如何使其具体化,你能帮我解决它吗?对不起,兄弟,是的,它改变了我的日期格式,但这不是我想要的,我的问题是当我回显日期时,它会得到我的所有线程的日期。这是图片中的结果链接=