procedural/crud_mysql/database/database_admin.php
# Returns true if the username exists in the database, false otherwise.
Returns true if the username exists in the database, false otherwise.
Returns true if the username exists in the database false otherwise .
function check_username_db($connection, $name)
{
	global $usersTable;
	$sql = "SELECT * FROM {$usersTable} WHERE username = '{$name}';";
	$res = mysqli_query($connection, $sql);
	if ($res == false) 
	{
		echo "Fatal. '{$usersTable}' table does not exist.";
		return false;
	}
	return mysqli_fetch_assoc($res);
}
function check_username_db ( $ connection , $ name ) { global $ usersTable ; $ sql = " SELECT * FROM  { $ usersTable }  WHERE username = ' { $ name } '; " ; $ res = mysqli_query ( $ connection , $ sql ) ; if ( $ res == false ) { echo " Fatal. ' { $ usersTable } ' table does not exist. " ; return false ; } return mysqli_fetch_assoc ( $ res ) ; }
Returns true if the username exists in the database, false otherwise.
Returns true if the username exists in the database false otherwise .