Rares Coco Rares Coco - 1 month ago 7
MySQL Question

combine 2 strings in one with some elements

The code looks like this:

$link .= '/'. . 'elevi' . .'/'. $clasa . '/' . $litera . '/' . $nume .'-'. $prenume;


But the error apear :


Parse error: syntax error, unexpected '.' in ...


But if the code looks like this :

$link .= $clasa . '/' . $litera . '/' . $nume .'-'. $prenume;


Works like this :

11/c/bobo-alex


and i want it to looks like this

./elevi/11/c/bobo-alex


with [dot] and slash first

Answer

You have to many string combining dots in your first segment.

You can also use "" instead of '' for PHP to auto-echo variable contents to the string.

$link .= "./elevi/$clasa/$litera/$nume-$prenume";
Comments