I have a mysql_query that must have WHERE columnName = '$variable1' in it. For example:
$result = mysql_query("SELECT * FROM database WHERE columnName = '$variable1'");
I want the contents of $variable1 to retrieve any value in ColumnName; sort of like a wildcard operator. I have tried using an asterisk (*) like this:
$variable1 = '*'
$result = mysql_query("SELECT * FROM database WHERE columnName = '$variable1'");
while($row = mysql_fetch_array($result)) {
// Echo the content of ALL ROWS IN TABLE here
}
The result of this query, when echoed, should display all the rows in the database. The asterisk does not work as a universal variable, nor does a blank space (e.g. $variable = ''). What is the wildcard operator in MySQL that would match all text combinations?
if($var == '*') $result = mysql_query("SELECT * FROM database.table"); else $result = mysql_query("SELECT * FROM database.table WHERE columnName = '$variable1'");what about this