Almost Working
Results 1 to 3 of 3

Thread: Almost Working

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    25

    Almost Working

    Hey there

    I almost had it working.

    The problem is I can only output 2 dates.

    global $i;
    global $k;
    $i = 0;
    $k = 0;
    while($row = mysqli_fetch_array($result))
    {
    $now = date("l jS F Y");
    $date = $row['Date'];
    $time = date("l jS F Y", $date);

    if($now == $time and $i==0)
    {
    global $i;
    echo "<h1>" . $time . "</h1>";
    echo "<table border='1' width='1000'>
    <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Book</th>
    <th>Subject</th>
    <th>Price</th>
    <th>Description</th>
    <th>Picture</th>
    </tr>";
    echo "<tr>";
    echo '<td><a class="top" href="DetailPage.php?ID=' . $row["ID"];
    echo '">' . $row['ID'] . '</a></td>';
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['book'] . "</td>";
    echo "<td>" . $row['subject'] . "</td>";
    echo "<td>" . $row['Price'] . "</td>";
    echo "<td>" . $row['Description'] . "</td>";
    echo "<td>" . "<img src=\"" . $row['picname'] . "\" width=100 height=100 />" . "</td>";
    echo "</tr>";
    echo "</table>";
    $i =1;
    }
    elseif($now == $time and $i!=0)
    {
    echo "<table border='1' width='1000'>
    <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Book</th>
    <th>Subject</th>
    <th>Price</th>
    <th>Description</th>
    <th>Picture</th>
    </tr>";
    echo "<tr>";
    echo '<td><a class="top" href="DetailPage.php?ID=' . $row["ID"];
    echo '">' . $row['ID'] . '</a></td>';
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['book'] . "</td>";
    echo "<td>" . $row['subject'] . "</td>";
    echo "<td>" . $row['Price'] . "</td>";
    echo "<td>" . $row['Description'] . "</td>";
    echo "<td>" . "<img src=\"" . $row['picname'] . "\" width=100 height=100 />" . "</td>";
    echo "</tr>";
    echo "</table>";

    }
    elseif($now != $time)
    {
    if($k == 0)
    {
    echo "<h1>" . $time . "</h1>";
    echo "<table border='1' width='1000'>
    <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Book</th>
    <th>Subject</th>
    <th>Price</th>
    <th>Description</th>
    <th>Picture</th>
    </tr>";
    echo "<tr>";
    echo '<td><a class="top" href="DetailPage.php?ID=' . $row["ID"];
    echo '">' . $row['ID'] . '</a></td>';
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['book'] . "</td>";
    echo "<td>" . $row['subject'] . "</td>";
    echo "<td>" . $row['Price'] . "</td>";
    echo "<td>" . $row['Description'] . "</td>";
    echo "<td>" . "<img src=\"" . $row['picname'] . "\" width=100 height=100 />" . "</td>";
    echo "</tr>";
    echo "</table>";
    $k =1;
    }
    elseif($k != 0)
    {
    echo "<table border='1' width='1000'>
    <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Book</th>
    <th>Subject</th>
    <th>Price</th>
    <th>Description</th>
    <th>Picture</th>
    </tr>";
    echo "<tr>";
    echo '<td><a class="top" href="DetailPage.php?ID=' . $row["ID"];
    echo '">' . $row['ID'] . '</a></td>';
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['book'] . "</td>";
    echo "<td>" . $row['subject'] . "</td>";
    echo "<td>" . $row['Price'] . "</td>";
    echo "<td>" . $row['Description'] . "</td>";
    echo "<td>" . "<img src=\"" . $row['picname'] . "\" width=100 height=100 />" . "</td>";
    echo "</tr>";
    echo "</table>";
    $now = $row['Date'];
    }
    }
    }

    How can one change the code so that the current date is shown and links are displayed underneath?

    Like:
    Thursday, Apr. 24...
    Bike for sale
    Car for sale
    Motorcycle for sale


    Wednesday, Apr. 23...
    [COLOR="#))))FF"]Bike for sale[/color]

  2. #2
    Junior Member
    Join Date
    Apr 2013
    Posts
    25
    Sorry ... how does one have the dates(Thursday with links, Wednesday with links, Tuesday with links) like the example above?
    I have it almost working I just need a little tweeting.

  3. #3
    Member
    Join Date
    Oct 2009
    Posts
    97
    What do you want the dates to link to?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •