Problem with using array_diff and array_combine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I hope I can explain what I am trying to do.
I have two tables the first one has the custom form elements


elements_id elements_field_type elements_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




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux