Home PHP while command missing first entry
Reply: 0

PHP while command missing first entry

user1848 Published in April 20, 2018, 10:49 am

I am trying to use the while loop to print multiple entries from a MySQL database. Everywhere I do this it is missing the first item on the list and only manages to print from the second one on.

require 'db.php';
$udate = $mysqli->escape_string($_POST['date']);
$result = $mysqli->query("SELECT * FROM videos WHERE date='$udate'");
$user = $result->fetch_assoc();
$_SESSION['file_name'] = $user['file_name'];
<!DOCTYPE html>
        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="css/nominatorstyle.css">  
        <div class="header">
            <form action="watch.php" method='POST'><table>
                    if($result->num_rows > 0){
                        while($row = $result->fetch_assoc()){
                            $vid = $row['vid'];                           
                            $source = "uploads/".$row['file_name'];
                            echo "<tr><td>".$row['vid']."</td>
                            echo "<td><a href=watch.php?
                    echo "0 results";
            <a href="profile.php"><button class="button-block">Home</button></a>

I'd like it to print all matching criteria. I'm getting only the entries after the first one.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.531982 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO