kyleldi Posted March 12, 2009 Share Posted March 12, 2009 I've got a little statement that uses the DO cmd to repeat a query on my db, but I have to put it in the middle of my echo. I keep getting an error on this line, yet I can't figure out what's not correct. Any ideas? My code that it fails on: echo "<div class='catdetail_header'><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>" ; My complete code: <?php if(isset($_GET['category'])){ echo "<div class='catdetail_header'><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>" ; do { echo '<div class="catdetail_header"><h1 class="style1">'.ucwords($row_rs_multi_dl['title']).'</h1></div> <div class="catdetail_desc"><p>'.$row_rs_multi_dl['description'].'</p></div> <div class="catdetail_footer"><a href="downloads/'.$row_rs_multi_dl['filetype'].'/'.$row_rs_multi_dl['filename'].'">Download Now</a></div>'; } while($row_rs_multi_dl = mysql_fetch_assoc($rs_multi_dl)); } else{ echo "<div class="catdetail_header"><h1 class="style1">Please Choose A Category</h1></div>"; do { echo '<div class="catdetail_header"><h1 class="style1"><a href="1">'.ucwords($row_rs_showcats['category']).'</a></h1> while($row_rs_showcats = mysql_fetch_assoc($rs_showcats))'; } ?> Thank You! Quote Link to comment https://forums.phpfreaks.com/topic/149134-solved-php-do-in-echo-statement/ Share on other sites More sharing options...
Maq Posted March 12, 2009 Share Posted March 12, 2009 You are using single quotes and double quotes incorrectly. Use double quotes for the whole string, and when you want to break in and out, but for values of attributes use single quotes: echo "".ucwords($row_rs_multi_dl['category']).""; Quote Link to comment https://forums.phpfreaks.com/topic/149134-solved-php-do-in-echo-statement/#findComment-783089 Share on other sites More sharing options...
Philip Posted March 12, 2009 Share Posted March 12, 2009 Look at this line with a syntax highlighter: echo "<div class='catdetail_header'><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>" ; echo '<div class="catdetail_header"><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>' ; See the difference? Quote Link to comment https://forums.phpfreaks.com/topic/149134-solved-php-do-in-echo-statement/#findComment-783091 Share on other sites More sharing options...
lonewolf217 Posted March 12, 2009 Share Posted March 12, 2009 it seems you aren't escaping your quotes properly in your echo statements for example, the one line you posted should be this <?php echo "<div class='catdetail_header'><h1 class=\"style1\">".ucwords($row_rs_multi_dl['category'])."</h1>" ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/149134-solved-php-do-in-echo-statement/#findComment-783092 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.