Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php query to hide duplicate records

For example

First, orderby grouping row and then add other orderby columns:

order by keyword, day;

second, skip the similar elements in loop:

if ($result = $mysqli->query($query)) {
    $last_keyword = null;
    // fetch associative array
    while ($row = $result->fetch_assoc()) {
        if($row["keyword"] != $last_keyword){
             // print the changed keyword
             echo $row["keyword"];
             // set the last keyword to the new keyword
             $last_keyword = $row["keyword"];
        }
        // do your other listings here
    }

    // free result set
    $result->free();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #query #hide #duplicate #records
ADD COMMENT
Topic
Name
3+8 =