fetch data from phpmyadmin code example

Example: fetch data from phpmyadmin

//use this for if statements
$sql = "SELECT * FROM table-name WHERE table-column='variable-in-code' "; //sql code 
$results = mysqli_query($connection-to-database-variable, $sql); //sends sql code

if(mysqli_num_rows($results) > 0){
  $row = mysqli_fetch_assoc($results);
  echo $row['column-name'];
}

//check if data is equal to something
if(mysqli_num_rows($results) == $type){
  echo text;
}


//use this for while loops
//this will display everything in that column
while($row = mysqli_fetch_array($results)){
	echo $row['column-name'];
}

Tags:

Php Example