imimin Posted July 27, 2009 Author Share Posted July 27, 2009 Sorry for the simple question...how do I do that? Quote Link to comment Share on other sites More sharing options...
vineld Posted July 27, 2009 Share Posted July 27, 2009 echo "<br />"; Quote Link to comment Share on other sites More sharing options...
imimin Posted July 27, 2009 Author Share Posted July 27, 2009 Now its printing out like this: fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00241.jpg", "", ""]<br />fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00256.png", "", ""] Quote Link to comment Share on other sites More sharing options...
vineld Posted July 27, 2009 Share Posted July 27, 2009 You told us you wanted an html line break inbetween, that is also what you have. What to you mean by "prints"? Where do you display the result? I assume you want \n instead? Quote Link to comment Share on other sites More sharing options...
imimin Posted July 27, 2009 Author Share Posted July 27, 2009 I just need my output to print like this: fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00210.jpg", "", ""] fadeimages[1]=["http://www.patternsofjoy.com/images/thumbs/POJ00222.jpg", "", ""] fadeimages[2]=["http://www.patternsofjoy.com/images/thumbs/POJ00224.jpg", "", ""] maybe my choice of words was not correct when I mentioned putting a <BR> between each line. I just assumed that is what I needed to get the output to look like the above output? Quote Link to comment Share on other sites More sharing options...
vineld Posted July 27, 2009 Share Posted July 27, 2009 Read what I just posted... It all depends on where you want to produce the output. Like I said, \n will probably give you what you want. Quote Link to comment Share on other sites More sharing options...
imimin Posted July 27, 2009 Author Share Posted July 27, 2009 Thank you! I set it up like this: <?php /*$cat = mysql_real_escape_string($_GET['cat']);*/ $cat='all'; $get_items = "SELECT * FROM poj_products WHERE cat='$cat'"; $get_items = mysql_query($get_items); while($item_row = mysql_fetch_assoc($get_items)) { extract($item_row); echo 'fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/'.$item_row['img-no_path'].'", "", ""]'; \n; } ?> and I am still getting: fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00241.jpg", "", ""]fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00256.png", "", ""]fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00257.png", "", ""] Quote Link to comment Share on other sites More sharing options...
vineld Posted July 27, 2009 Share Posted July 27, 2009 You have absolute no clue as to what you're doing I assume? echo 'fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/'.$item_row['img-no_path'].'", "", ""]' . '\n'; You need to learn the basics of both php and html it seems. Also, I would advice you to read about new line characters. <br> is a line break in html, nowhere else. Quote Link to comment Share on other sites More sharing options...
imimin Posted July 27, 2009 Author Share Posted July 27, 2009 I just ordered a good book on the subject, looking for ward to it ! Just tried the last code you gave me and now I get this as an output: fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00241.jpg", "", ""]\nfadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00256.png", "", ""] Quote Link to comment Share on other sites More sharing options...
vineld Posted July 27, 2009 Share Posted July 27, 2009 Exactly where do you produce the output? Directly in an html document? <br> should work in that case. Quote Link to comment Share on other sites More sharing options...
imimin Posted July 27, 2009 Author Share Posted July 27, 2009 Being generated server side so when you look at source on a web browser you see it. It's the first part of a JS. I know the code works with the JS, my only problem is at this point to get it to print correctly to: fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/POJ00210.jpg", "", ""] fadeimages[1]=["http://www.patternsofjoy.com/images/thumbs/POJ00222.jpg", "", ""] fadeimages[2]=["http://www.patternsofjoy.com/images/thumbs/POJ00224.jpg", "", ""] Quote Link to comment Share on other sites More sharing options...
vineld Posted July 27, 2009 Share Posted July 27, 2009 Yeah, I knew it was generated serverside but not where it was displayed, that is the only thing that matters Now that we know it's javascript you're producing I was a bit too quick. \n will work fine but since you use single quotes for the echoed strings it will not work properly. You need to break out of them: echo 'fadeimages[0]=["http://www.patternsofjoy.com/images/thumbs/'.$item_row['img-no_path'].'", "", ""]' . "\n"; That should do it. Quote Link to comment Share on other sites More sharing options...
imimin Posted July 27, 2009 Author Share Posted July 27, 2009 Thanks, that did the trick! I really appreciate all of your help! I will mark the problem 'solved'! Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 27, 2009 Share Posted July 27, 2009 i should point out that PHP_EOL is usually a better solution than "\n" as the newline character may change depending on your server. just a thought. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.