1

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;
0

4 Answers 4

4
$row1 = $autovalue . "_1";
$row2 = $autovalue . "_2";
$row3 = $autovalue . "_3";
$row4 = $autovalue . "_4";
Sign up to request clarification or add additional context in comments.

Comments

2

you can also add texts by this way :

$text = '12';

$text .= '34';
$text .= '56';
$text .= '78';

echo $text;

the result will be : 12345678

Comments

1

Personally preferred:

$row1 = sprintf( '%s_1', $autovalue );

See the manual's page about sprintf for further information.

Comments

1
$row1 = $autovalue."_".1;

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.