Let’s say that I have a database with this data stored:
Email-Link-Link2 1E@231-Example1-Example2 1E@231-Example3-Example4
How can I select all of this value with a PDO query excluding those seen before, so in this case 1E@231,will select only one time.
Advertisement
Answer
If understand what you said, this is your answer:
Connexion to data base with PDO
<?php //CONNEXION TO DATA BASE WITH PDO... $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $base = new PDO('mysql:host=localhost;dbname=your_data_base', 'the_user', 'Your_password', $pdo_options); //end of connexion to data_base ;?>
NOW getting data from data base with not duplication(you can use sql function DISTINCT
<?php $sc=$base->query("SELECT DISTINCT Email FROM table_where_data_stored"); while($data_distinct =$sc->fetch()){ //your data will be displayed here ;} ;?>
May this help you!!