Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
This currently works…
$resultInput = mysql_query("SHOW COLUMNS FROM " . $table. " WHERE Field NOT IN ('id', 'created', 'date_modified', 'content', 'type', 'bodytext', 'project_content', 'content_short') AND Field NOT LIKE '%_image%'");
However I would like to remove all the fields with the name content and add it to the LIKE function with something like %content%
$resultInput = mysql_query("SHOW COLUMNS FROM " . $table. " WHERE Field NOT IN ('id', 'created', 'date_modified', 'type', 'bodytext') AND Field NOT LIKE ('%_image%', %content%)");
But this doesn`t seem to work? and returns a”
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
C:\xampp\htdocs\framework.php on line 33
What you are attempting is actually a syntax error.
LIKEconditions must be individually listed and separated byANDorOR. In your case however, you can do it withREGEXPby separating the conditions with|:Because the regular expression will match the patterns
contentor_imageanywhere insideField, there is no need for any additional equivalent characters to the%wildcards used inLIKE.We assume that
$tablehas been compared against a list of valid table names to use in this query for security purposes.Finally, you received the fatal error
mysql_num_rows()expects parameter 1 to be resource because you performed no error checking on the query result.