Is it possible to make this operation? $musica = vyber_detaily_cd($EAN_kod);
$ciste = vyber_detaily_media($EAN_kod);

How I join this variable? $ musica and $ ciste to one variable: $cd ? function vyber_detaily_cd and vyber_detaily_media($EAN_kod) select details of product which is in database and I need display this detail in shop basket when is used only one variable $cd. So I must join it to one variable $cd.

8 Years
Discussion Span
Last Post by petr.pavel

Lets us know what type of details are these variables are getting...

If the $ciste and $musica are getting any single string value, then (.)dot opetator is enough for concantinating them..

If they comprise intiger values then (.) will simply put them together... l
for exa $musica=1 and $cistae =2;
and the $musica.$ciste=12.

U can use it according to the situations..



It dont go correctly. join $cd=$musica.$ciste; is no good. How are join it?Please help me


no it is meny date from tables.It is string and numbers.


Could u please echo these variables and post that variables in the thread.. It will give a more clear idea for us...



I can translate for you, pal :-) I'm Czech too.
(Můžu ti překládat, jsem taky Čech.)

We need to know of what type the return values are: arrays or objects?
(Potřebujeme vědět, jakého typu jsou návratové hodnoty těch funkcí: pole nebo objekty?)


Data which I give to variable $ciste and $musica is data from tables :row of tables is EAN_kod=string, medium=string, typ=string, znacka=string, kusy=string,obal=string every this data from every row I give to variable $ciste .

To variable $musica is the same.


this is for example one function

function vyber_detaily_media($EAN_kod)
//funkcia ziskavajuca z databazy detaily konkretneho media podla EAN kodu
//poziadavka pre databazu o konkretne detaily media
if (!$EAN_kod || $EAN_kod=="")
return false;

$conn = db_connect();
$query = "select * from ciste_media where EAN_kod='$EAN_kod'";
$result = @mysql_query($query);
if (!$result)
return false;
$result = @mysql_fetch_array($result);
return $result;


Ok, so what you want is to join two arrays?
then: array_merge()
I still don't get it. Let's say that your data is, for instance,

$musica = array("nazev"=>"Justice for all", "artist" => "Metallica");


$ciste = array("nazev"=>"Confession on the dance floor", "artist" => "Madonna");

then what do you expect $cd to be?

$cd = array(
 0 => array("nazev"=>"Justice for all", "artist" => "Metallica"),
 1 => array("nazev"=>"Confession on the dance floor", "artist" => "Madonna")

then do $cd = array($musica, $ciste);
or this?

..."nazev" => "Justice for allConfession on the dance floor"...?

then you need a function to foreach($musica as $attribute => $value) and join values with the dot operand ($musica[$attribute] = $musica[$attribute].$ciste[$attribute])

Man, learn to give information.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.