fetch data from phpmyadmin

Solutions on MaxInterview for fetch data from phpmyadmin by the best coders in the world

showing results for - "fetch data from phpmyadmin"
Damien
17 Feb 2016
1//use this for if statements
2$sql = "SELECT * FROM table-name WHERE table-column='variable-in-code' "; //sql code 
3$results = mysqli_query($connection-to-database-variable, $sql); //sends sql code
4
5if(mysqli_num_rows($results) > 0){
6  $row = mysqli_fetch_assoc($results);
7  echo $row['column-name'];
8}
9
10//check if data is equal to something
11if(mysqli_num_rows($results) == $type){
12  echo text;
13}
14
15
16//use this for while loops
17//this will display everything in that column
18while($row = mysqli_fetch_array($results)){
19	echo $row['column-name'];
20}