Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Zaharia David
- $servername = "127.0.0.1";
- $username = "root";
- $password = "";
- $dataBase = "concurs";
- $con = new mysqli ($servername , $username , $password , $dataBase);
- if(!$con)
- die("Conectare nereusita");
- $n=0; // n = nr de judete ;
- // parcurgem tabela si memoram toate numele de judete distincte
- $interog = "select judet from concurs irder by judet";
- $rez = mysqli_query($con , $interog);
- while ($linie = mysqli_fetch_array($rez))
- {
- $x = linie["judet"];
- $x = trim($x);
- // caut pe x in vectorul de judete
- // daca nu apare il adaug
- $gasit = 0 ;
- for ($i = 0 ; $i < $n && $gasit == 0 ; $i++)
- if($a[$i] == $x) $gasit = 1 ;
- if ($gasit == 0 )
- {
- $a[$n] = $x;
- $n++;
- }
- }
- for ($i = 0 ; $i < $n ; $i++)
- echo $a[$i]."<br>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement