harkly Posted April 19, 2011 Share Posted April 19, 2011 I am trying to get a <br> to come before if ($r['othr_pet']) $string .= $r['othr_Pet_txt']; So that if the string has something in it, it will properly break before as like the Cat & Fish while($r = mysql_fetch_array($sql)) { $string = ""; if ($r['dog']) $string .= "Dog(s) "; if ($r['cat']) $string .= "<br>Cat(s) "; if ($r['fish']) $string .= "<br>Fish(s) "; if ($r['othr_pet']) $string .= $r['othr_Pet_txt']; echo " $string "; } // END While The out come I am looking for is to Quote Link to comment https://forums.phpfreaks.com/topic/234162-add-a-to-string/ Share on other sites More sharing options...
spiderwell Posted April 19, 2011 Share Posted April 19, 2011 cant you add it in the same way you have the others? Quote Link to comment https://forums.phpfreaks.com/topic/234162-add-a-to-string/#findComment-1203548 Share on other sites More sharing options...
harkly Posted April 19, 2011 Author Share Posted April 19, 2011 I think that I can but I don't know the syntex to do so Quote Link to comment https://forums.phpfreaks.com/topic/234162-add-a-to-string/#findComment-1203589 Share on other sites More sharing options...
harkly Posted April 19, 2011 Author Share Posted April 19, 2011 was missing the "." if ($r['othr_pet']) $string .= "<br>" . $r['othr_Pet_txt']; Quote Link to comment https://forums.phpfreaks.com/topic/234162-add-a-to-string/#findComment-1203596 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.