/    Sign up×
Community /Pin to ProfileBookmark

Mulitple Quotes Problem

I need to echo this code:

[code=php]$linkDay=>array(‘#’,’style’,”MM_openBrWindow(‘page.php?id=”.$row_recordset[‘id’].”‘,’Green’,’scrollbars=yes,width=”300″,height=”500″‘)”,NULL.$linkDay),[/code]

But when i place it in quotes for the echo, they cancel eachother out, like this:

[code=php]echo “$linkDay=>array(‘#’,’style’,”MM_openBrWindow(‘page.php?id=”.$row_recordset[‘id’].”‘,’Green’,’scrollbars=yes,width=”300″,height=”500″‘)”,NULL.$linkDay),”[/code]

Any suggestions?

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@felgallJun 08.2005 — linkDay=>array('#','style',"MM_openBrWindow('page.php?id=".$row_recordset['id']."','Green','scrollbars=yes,width="300",height="500"')",NULL.$linkDay),
Copy linkTweet thisAlerts:
@BeachSideJun 08.2005 — to echo the array out you should use a foreach loop

kinda like...
[code=php]
foreach($linkDay as $value) {
echo "$value <br>n";
}
[/code]
Copy linkTweet thisAlerts:
@wkraussauthorJun 08.2005 — Ok now I am running into another problem so I'll just see if there is a better way of doing this. Here is what I am trying to do. I am trying to have the following code and repeat one line of it. Here is what I have so far but it obviously dosent work:
[code=php]$days = array($today=>array(NULL,'calendar-day',NULL,NULL.$today.'</span>'),
do {
$linkDay=>array('#','calendar-linked',"MM_openBrWindow('detailAppearances.php?id=".$row_rsAppearances['id']."','Green','scrollbars=yes,width=".$row_rsPage['winWidth'].",height=".$row_rsPage['winHeight']."')",NULL.$linkDay.'</a>'),
} while ($row_rsAppearances = mysql_fetch_assoc($rsAppearances));
);[/code]

And I get this:Parse error: parse error, unexpected T_DO, expecting ')' [/QUOTE]
So I tried to fix it by wrapping some of it in quotes and using echo, then the repeat function worked but instead of the code being repeated it was displayed as literal text.
Copy linkTweet thisAlerts:
@BeachSideJun 08.2005 — Ok now I am running into another problem so I'll just see if there is a better way of doing this. Here is what I am trying to do. I am trying to have the following code and repeat one line of it. Here is what I have so far but it obviously dosent work:
[code=php]$days = array($today=>array(NULL,'calendar-day',NULL,NULL.$today.'</span>'),
do {
$linkDay=>array('#','calendar-linked',"MM_openBrWindow('detailAppearances.php?id=".$row_rsAppearances['id']."','Green','scrollbars=yes,width=".$row_rsPage['winWidth'].",height=".$row_rsPage['winHeight']."')",NULL.$linkDay.'</a>'),
} while ($row_rsAppearances = mysql_fetch_assoc($rsAppearances));
);[/code]

And I get this:

So I tried to fix it by wrapping some of it in quotes and using echo, then the repeat function worked but instead of the code being repeated it was displayed as literal text.[/QUOTE]


In your code there you are missing a ) as the error says...

It should be
[code=php]
$days = array($today=>array(NULL,'calendar-day',NULL,NULL.$today.'</span>')),
[/code]
Copy linkTweet thisAlerts:
@Stephen_PhilbinJun 09.2005 — A quick tip for testing is to use var_dump($array_variable); to see the contents of the array at a glance. Just stick it between <pre> tags of html to make it more readable. You can do it with any kind of variable, but it's particularly handy on arrays and multi dimensional arrays.
Copy linkTweet thisAlerts:
@wkraussauthorJun 09.2005 — Actually BeachSide, thats not the problem, its that it wasn't expecting the do while loop where it was but was expecting the rest of the array, so it endede at the do part. But, I still need a way to repeat that one line of code between the do and while. When I enclosed everything in quotes and used an echo, the code worked but was displayed as visual text on the website instead of the code it should be. I need some more effective way to loop that line of code. ARG. Thanks for the input so far, its kinda helping...
Copy linkTweet thisAlerts:
@BeachSideJun 09.2005 — No matter what you needed that ) to close the thing.

Also I was looking at that earlier and was wondering why you have a do-while loop you don't really need it, just do a while loop...

but as I look at it more what is it you are trying to accomplish by having that array in the first place? Can't you put the data from the db into the array and plug it into the string you want to echo out?

also in that muti dimensional array you have shouldn't you be calling $today by reference like this &$today
Copy linkTweet thisAlerts:
@wkraussauthorJun 09.2005 — That script I am using is part of a clanedar script. I will display a visual callendar and the line I am trying to get repeat would link create a link in the calendar for teh corresponding day in the database, but I cannot get it to repeat so all that works right now is if I replace the $linkDay with a number, lets say 15, then on the callendar the 15th would become linked to that page I have specified in the array (the MM_openBrWindow). The origional script can be found at www.keithdevens.com/software/php_calendar I have just manipulated it to do waht I need, and everything I have changed so far works except for this one part.
Copy linkTweet thisAlerts:
@SpectreReturnsJun 10.2005 — I would suggest just a while loop. Do.while isn't nessecary, and is harder to work with (in my opinion).
×

Success!

Help @wkrauss spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,
)...