Usage Environment:Talent Network project has a resume privacy settings, which have a filter keyword, only one enterprise company name contains one of the keywords, it does not show the resume, of course, I have not done there, now is to do the addition of keywords to delete.
Imagine:No matter how many resumes a person has, all resumes are set to the exact same keyword filter (mostly with very few people, so storage doesn't matter, and it's easy to use in search), and then make all the keywords a comma-delimited string.
Challenges:When I show it I convert the string into an array and then loop it out, but now I'm going to delete the specified keyword.
Solution:Since the conversion into an array, then there are values have keys, I will be the key to delete the page, delete the value of the specified key is good.
Challenges:How to remove the specified key from the array, I only see the filter, into the stack, out of the stack, do not see the removal of the specified key value of the built-in function.
Now, this function has appeared, it is called array_splice, it can easily remove the value of the specified key, and then return a new array
Code Snippet:
Copy CodeThe code is as follows:
$sql = "";
$sql. = "Select Key_secret from". T_. " Resume_relation_xuyinjie ";
$sql. = "WHERE 1=1";
$sql. = "and UserID = '". $userid. "' ";
$result = @mysql_query ($sql) or Die (' #41 # ');
$row = @mysql_fetch_array ($result, MYSQL_ASSOC);
$key =explode (",", $row [' Key_secret ']);//Conversion Group
Array_splice ($key, $autoid, 1); Delete the specified key value
$key _secret=implode (",", $key); into a string that is easy to store
?>
$autoid is the key to the current value passed in, Array_splice ($key, $autoid, 1) means to remove from the $key array, starting with $autoid, removing a set of
Array_splice itself is a very powerful built-in function that can be used for array-to-string exchange, array-to-array exchange, not read manuals
http://www.bkjia.com/PHPjc/328030.html www.bkjia.com true http://www.bkjia.com/PHPjc/328030.html techarticle use of the environment: The Talent Network project has a resume privacy settings, which has a filter keyword, only one enterprise company name contains one of the keywords, it does not show the copy ...