crmamx Posted March 21, 2011 Share Posted March 21, 2011 // Other code //echo "<table border='10' cellpadding='3' cellspacing='2'>"; This works echo "<table class="my-table">"; //This does not work echo "<tr><th>First Name</th><th>Last Name</th><th>Home Phone</th><th>Cell Phone</th><th>email</th></tr>"; // keeps getting the next row until there are no more to get ================ while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table ========================== echo "<tr><td>"; echo $row['first']; echo "</td><td>"; echo $row['last']; echo "</td><td>"; echo $row['phone']; echo "</td><td>"; echo $row['cell']; echo "</td><td>"; echo $row['email']; echo "</td></tr>"; } echo "</table>"; ?> Error message: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/bayare27/public_html/content/pages/display_all_members1.php on line 29 Line 29 is: echo "<table class="my-table">"; <table class="my-table">" is a valid statement because It works in another program, but html not php Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/ Share on other sites More sharing options...
adamlacombe Posted March 21, 2011 Share Posted March 21, 2011 echo "<table class="my-table">"; slash out the quotes Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/#findComment-1190283 Share on other sites More sharing options...
Pikachu2000 Posted March 21, 2011 Share Posted March 21, 2011 You've enclose double quotes within a double-quoted string. The enclosed quotes need to be escaped with a backslash. Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/#findComment-1190284 Share on other sites More sharing options...
PFMaBiSmAd Posted March 21, 2011 Share Posted March 21, 2011 OR the quotes within the string need to be changed to single-quotes. Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/#findComment-1190287 Share on other sites More sharing options...
Pikachu2000 Posted March 21, 2011 Share Posted March 21, 2011 OR the enclosing quotes can be changed to single quotes . . . Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/#findComment-1190289 Share on other sites More sharing options...
crmamx Posted March 21, 2011 Author Share Posted March 21, 2011 slash out the quotes The enclosed quotes need to be escaped with a backslash. You guys talk a foreign language.. But I was able to Google it and find how to do it. Works like a charm. My undersized brain would have understood the single quotes but that wasn't posted until after I researched the other. Many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/#findComment-1190312 Share on other sites More sharing options...
Pikachu2000 Posted March 21, 2011 Share Posted March 21, 2011 That's a good thing, then. It means you learned another piece of valuable information about PHP's syntax. Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/#findComment-1190319 Share on other sites More sharing options...
crmamx Posted March 21, 2011 Author Share Posted March 21, 2011 That's a good thing, then. It means you learned another piece of valuable information about PHP's syntax. You are right. First time I have ever encountered that. I am sure I must have read about it in the tutorials but it did not stick with me. Quote Link to comment https://forums.phpfreaks.com/topic/231273-echo-table-statement-wont-work/#findComment-1190399 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.