Reputation: 6799
I have a variable named "$autovalue" . My another variable called $row1 and I want it to contain the value of "$autovalue" with a "_1" so that when I echo the $row1 it looks like this: 2011_1 (here 2011 is the value of $autovalue and " _1 " is what I want to include). I tried the following method but it is not working.
Could you please tell me how to achieve this ?
Thanks in Advance :)
$autovalue=mysql_insert_id();
$row1=$autovalue.""._1;
$row2=$autovalue.""._2;
$row3=$autovalue.""._3;
$row4=$autovalue.""._4;
Upvotes: 1
Views: 14055
Reputation: 1066
you can also add texts by this way :
$text = '12';
$text .= '34';
$text .= '56';
$text .= '78';
echo $text;
the result will be : 12345678
Upvotes: 2
Reputation: 4064
Personally preferred:
$row1 = sprintf( '%s_1', $autovalue );
See the manual's page about sprintf for further information.
Upvotes: 1
Reputation: 2553
$row1 = $autovalue . "_1";
$row2 = $autovalue . "_2";
$row3 = $autovalue . "_3";
$row4 = $autovalue . "_4";
Upvotes: 4