0

I wanna write a cool function to preview a PDF file before store it into my hard drive. The problem is: i have 2 arrays. The first table has users input data and the second table has the description of the service. For example: 1st table has the key values: ID NAME LASTNAME SERVICE_ID 2nd table has only 1 key value: SERVICE_DESCRIPTION My question is: Can i combine the values into 1 array, so that i have 3rd array with these key values: ID NAME LASTNAME SERVICE_ID SERVICE_DESCRIPTION ? Thank you very much for your answers

5
  • How can you store 'SERVICE_DESCRIPTION' in a table without its id? Commented Jan 10, 2019 at 4:29
  • You can run a join query, anyway. Commented Jan 10, 2019 at 4:29
  • the problem is that the data of array 1 are NOT in the database. But the data of the array 2 are in the database. If both was into the database then the join method is the best way ... Commented Jan 10, 2019 at 4:33
  • I think, you are getting it wrongly, what ever its , you can not save any service description in a data base without a distinct id. add a column id . then you can merge it with array or whatever you want to do Commented Jan 10, 2019 at 4:36
  • You can merge two arrays with this function, array_merge() Commented Jan 10, 2019 at 4:49

2 Answers 2

2

You can merge two arrays with this function, array_merge()

Sign up to request clarification or add additional context in comments.

Comments

2

as @inzamam suggested you can do

$a = ["ID NAME" => "some val", "LASTNAME" => "some val", "SERVICE_ID" => "some val"];
$b = ["SERVICE_DESCRIPTION " => "some val"];
$c = array_merge($a,$b); // you can merge multiple arrays as you want

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.