Jump to content

Variable advise


sebastiaandraaisma

Recommended Posts

HI I could use some advise for my variable :)

I'm using:
$title = echo "<strong>".($row["sellrenttext"]).echo ", ".($row["typeofobjecttext"]).echo ", ".($row["city"]).echo ", ".($row["countrytext"]).echo ", ".($row["price"], 0, ',', ' ').echo " ".($row["currencycode"]).echo "</strong>".echo "<BR><BR>".($row["objectdes"]);

But I get a Parse error on this line telling me
Parse error: syntax error, unexpected T_ECHO

I was wondering if I could place an echo in a variable or if I maybe forgot something here?

(I'm a newbee) ;)

Any advise is welcome!
Sebas.
Link to comment
Share on other sites

I now tried:

$title = $var = echo "<strong>".($row1["sellrenttext"]).", ".($row2["typeofobjecttext"]).", ".($row3["city"]).", ".($row4["countrytext"]).", ".($row5["price"], 0, ',', ' ')." ".($row6["currencycode"])."</strong><BR><BR>".($row7["objectdes"]);

and also:
$title = echo
instead of $title = $var = echo

But I get the same "Parse error: syntax error, unexpected T_ECHO" error on this line.

I must be doing somrthing wrong, its just that I can't see what :)
Any help is welcome!

Kind regards,
Sebastiaan
Link to comment
Share on other sites

Why do you want to put echo in a variable? I think you mean you want to echo the variable.
[code]
$var = "<strong>".($row1["sellrenttext"]).", ".($row2["typeofobjecttext"]).", ".($row3["city"]).", ".($row4["countrytext"]).", ".($row5["price"], 0, ',', ' ')." ".($row6["currencycode"])."</strong><BR><BR>".($row7["objectdes"]);

echo $var;
[/code]
Link to comment
Share on other sites

Yes, you are both right. It was not my intention to echo something inside a variable but echo the variable :)

I'm just verry new and though that this was the proper way to insert strings and variables inside a new one.

I have tried both your solutions (single quotes and double quotes) I no longer get the echo error but now I see this one:

Parse error: syntax error, unexpected ','

The code looks now like this:
$title = "<strong>".($row1["sellrenttext"]).", ".($row2["typeofobjecttext"]).", ".($row3["city"]).", ".($row4["countrytext"]).", ".($row5["price"], 0, ',', ' ')." ".($row6["currencycode"])."</strong><BR><BR>".($row7["objectdes"]);

I also tried:
$title = '<strong>'.$sellrent.', '.$typeobject.', '.$city.', '.$country_1.', '.$currency.'</strong><BR><BR>'.$short_des;

Hereby I had extracted the variables and created new ones, sounds complicated I know ;)

What I try to accomplish is that it generates some text inside a variable that I will use for a google map on my website :)

I just need to get this variable to work before I can experiment any further :)
All advise is apriciated and welcome.

Kind regards,
Sebas
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.