I am trying to get my code to echo the containing result if its matched from any column on a specific table. I read somewhere that there is no wildcard for columns so other than listing all the column names is there another way I can do this so that the column names are automatically generated?
there will never be multiple results so im not worried about listing them all… just want to find if the search string (which is a number) matches any field of any column on entire table.
[php]
<?php $db_server = "localhost"; $db_username = "--------------------"; $db_password = "--------------------"; $db_name = "----------------------"; mysql_connect("$db_server","$db_username","$db_password"); mysql_select_db("$db_name"); $query = mysql_query("select * from table where (ANYCOLUMN) like '$variable'"); while($r = mysql_fetch_array($query)) { echo $r; } ?>[/php]