Say I have appearances of this is the RED color, this is the BLUE color, this is WHATEVER color as parts of the different sentences they belong to, in different cells of the column column in the table table of my mySQL database, or in the same row if this table.
----------------------------------------------------------------------------------------
| column |
----------------------------------------------------------------------------------------
| Look, this is the red color which is is not a nice one. |
----------------------------------------------------------------------------------------
| And this is the blue color, I like it more. |
----------------------------------------------------------------------------------------
How could I perform the search in the database for this is the % color for exact match and put the results into PHP array, so that I could output the array exactly like
this is the RED color
this is the BLUE color
this is WATEVER color
skipping all other parts of the respective sentences? I mean I need to put into the array only every appearance of this is the CURRENT_WILDCARD_VALUE color and nothing more.
So far I have the following PHP code
global $wpdb;
$query = $wpdb->get_results( "SELECT * FROM table WHERE row LIKE '% this is the % color %'");
print_r($query);
which returns tons of extra data while I need it to return only my search term keeping in mind the wildcard it uses.
likeorregexp. Do you want to only allow one series of alpha characters betweentheandcolor? If so I thinkregexp 'this is the [a-zA-Z]+ colorwould do it. If color is always caps take outa-z(the mysql regexp might be case insensitive too so maybe it didnt matter)this it the LIGHT BLUE color. The problem is I also have no idea how to create the query and put the results into php array.