Problem with using array_diff and array_combine

From: Date: Sun, 27 Jul 2008 23:16:30 +0000
Subject: Problem with using array_diff and array_combine
Groups: php.general 
Request: Send a blank email to php-general+get-277373@lists.php.net to get a copy of this message
I hope I can explain what I am trying to do. I have two tables the first one has the custom form elements formelements_id formelements_field_type formelements_field_caption members_id 35 text test 8 36 text test2 8 The second one has the customer id and the field value withe the field name dbelements_field_name dbelements_field_value members_id customer_id 35 Test This Field 8 346
36 	                        8 	346
36 	 Test2 	                8 	347
If you look at the second table you will see that one field name is related to two different customers and one field name on relates to one customer. I am trying to look at these two tables and find customer that do not have a row for each field name. I have been trying with array_combine($dbelements_field_array,$dbelements_id_array) and also array_diff($customf_array,$dbelements_field_array) This are the tables I /am using to create the arrays /$contactsql = "SELECT * FROM contacts WHERE members_id = '8'"; $contact_result = |mysql_query|($contactsql); while($contact_row=mysql_fetch_array($contact_result)){ $contactid_array[] = $contact_row['id']; } $sql1 = "SELECT * FROM dbelements WHERE members_id = '8'"; $sql_result1 = |mysql_query|($sql1); while($row1=mysql_fetch_array($sql_result1)){ $dbelements_field_array[]=$row1["customer_id"]; $dbelements_field_array[].=$row1["dbelements_field_name"]; } $sql2 = "SELECT * FROM customformelements WHERE members_id = '8'"; $sql_result2 = |mysql_query|($sql2); while($row2=mysql_fetch_array($sql_result2)){ $customf_array[]=$row2["formelements_id"]; } Could somebody get me going in the right directions

« previous php.general (#277373) next »