0

this is my code

$sql = "SELECT * FROM `sale_history` WHERE `date` BETWEEN :fromdate AND :todate";
    $stmt = $PDO->prepare($sql);
    $stmt->bindParam(':fromdate', $_POST['fromdate'], PDO::PARAM_STR);
    $stmt->bindParam(':todate', $_POST['todate'], PDO::PARAM_STR);
    $stmt->execute();
    $total = $stmt->rowCount();
    while ($row = $stmt->fetchObject()) {
        echo "$row->date"; 
        echo "$row->product"; 
        echo "$row->username"; 
        echo "$row->quantity";
    }

but its not working, where is the mistake i did?

3
Contributors
2
Replies
15
Views
1 Year
Discussion Span
Last Post by diafol
0

For some reason the C++ like bindParam is looking better to most than the simpler question mark. For some reason you use fetchObject although it isn't really an object but an anonymous one. For some reason you echo it with double quotes. None of those would be an error. But the "not working" could mean a lot , what do you mean ? Do you get an error ? What this error is ? Is it simply not echoing anything ? Also provide us what the $PDO is .

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.