If i had a table that looked like this
# | name |
----------
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
how would i check if the table had the value of 4 under the name variable, and if it did to run something?
If i had a table that looked like this
# | name |
----------
1 | 1 |
2 | 2 |
3 | 3 |
4 | 4 |
how would i check if the table had the value of 4 under the name variable, and if it did to run something?
With php you can use inbuilt mysqli_num_rows() function, php documentation
mysqli_result::$num_rows -- mysqli_num_rows — Gets the number of rows in a result
$q = "select name from table where name = '4'";
$r = $mysqli->query($q);
if ($r->num_rows > 0) {
echo "exists";
} else {
echo "not exists";
}