I have the following code:
Code: Select all
function term_insert($String1, $String2)
{
$countries = explode("|", $String1);
$subs = explode("|", $String2);
$treference = mysql_query("SELECT * FROM drupal_term_node");
for each ($countries as $value)
{
<Find $value in the $treference array and lookup the assigned tid value>
//Insert data into the Drupal_term_node table
mysql_query("INSERT INTO drupal_term_node
VALUES ($NID_Value, $VID_Value, $TID_Value)");
for each ($subs as $value1)
{
$value1 == $value.$value1 //concatinate the two values
<Find $value1 in the $treference array and lookup the assigned tid value>
//Insert data into the Drupal_term_node table
mysql_query("INSERT INTO drupal_term_node
VALUES ($NID_Value, $VID_Value, $TID_Value)");
}
}
}The part I am having trouble with is this:
I have a value, I want to find that value in the array I have made.
So I want to search the array $treference for $value, and when it is found, return the row it is on.
If it is not found, then skip the loop and move onto the next value.
Any ideas if I can do this?
Kind Regards
Tom