Do not use on any
shared computer
September 5, 2008 04:45pm pdt
 
[x]
Attachment Details

How do I pull existing values in a database and update it as an array with new values?

Tags: PHP, MYSQL
Hello Experts,  Thanks for Any help on this
How do I pull existing values in a database and update it as an array with new values?

Here is my table with some values

ID      NAME            ADDRESS            TYPE      TRACKINGNUMBER
1      Delivered                 111 gogo ln     2008-06-17T11:29:15               5551212


What I am wanting to do is Pull the above information and update it with the below


ID            NAME          ADDRESS            TYPE            TRACKINGNUMBER
1      Delivered, Picked UP    111 gogo ln, 1112 gogo ln      2008-06-17T11:29:15,2008-06-17T11:29:15   5551212



Thanks for any help or comments.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
   foreach ($response -> TrackDetails -> Events as $event)
        {
	        
            if(is_array($response -> TrackDetails -> Events))
            { 
	 
		$eventss = std_class_object_to_array($event);
		$namecheck = "{$eventss[EventDescription]}";
		$addresscheck = "{$eventss[Address][City]} {$eventss[Address][StateOrProvinceCode]}";
		$typecheck = "{$eventss[Timestamp]}";
	
	  if($addresscheck==' ' || $addresscheck=='' || $addresscheck==NULL){
		    $addresscheck='New Hyde Park NY';
}    
	 
 
    $query = mysql_query( "SELECT * from markers where trackingNumber=$tracking &&  FIND_IN_SET('$addresscheck', address)"); 
    if( mysql_num_rows( $query ) <= 0 ) 
    { 
	
  	
        mysql_query( "insert into markers(name,address,type,color,trackingNumber)values('$namecheck','$addresscheck','$typecheck','#B10101','$tracking')" );
        
        
}else{
 
 
	 $res=mysql_query("select id,address,name,type from markers where FIND_IN_SET('$addresscheck', address)") or die(mysql_error());
	
	// This is where I need to do the update by selecting the current value in the database and replace it with the new array 
	 
  
        mysql_query( "update markers set address='$addressarray', name='$namearray' ,type='$typearray' where id='$id'" );
	
		
}
	 
	 
	
    
}
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Web Development
Question Asked By: Devain
Solution Provided By: Roonaan
Participating Experts: 1
Solution Grade: B
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by Roonaan

Rank: Genius

Expert Comment by Roonaan:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Devain
Author Comment by Devain:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by Roonaan

Rank: Genius

Accepted Solution by Roonaan:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Devain
Author Comment by Devain:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Devain
Author Comment by Devain:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628