Dan_Mason Posted October 22, 2008 Share Posted October 22, 2008 Hello! First post so sorry if you've heard this all before etc but i really could use the help! As You can See below, the syntax is correct, and i have no problems in generating a Dynamic HTML table, using MySQL. But Here, when I try to change the cell width, the text editor shows that my Syntax is wrong, and i dont really understand what im doing wrong. And when i bring it up in the browser, the following error occurs: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\AppServ\www\Practice\DynamicReport.php on line 99 Can Anyone Help Me? ??? Link to comment https://forums.phpfreaks.com/topic/129544-dynamic-html-table-problems/ Share on other sites More sharing options...
phpcodec Posted October 22, 2008 Share Posted October 22, 2008 on line 99 it should be echo "<td width=\"20\">" . $row['Alloy'] ."</td>"; Link to comment https://forums.phpfreaks.com/topic/129544-dynamic-html-table-problems/#findComment-671636 Share on other sites More sharing options...
JasonLewis Posted October 22, 2008 Share Posted October 22, 2008 It's width="value". But that's not the point. Notice how you open the string with double quotes. You cannot place double quotes inside the string UNLESS you escape them. Here is an example: echo "<td width="5">Hello</td>"; #Wrong, this will throw a parse error because you are using double quotes inside the string. echo "<td width=\"5\">Hello</td>"; #Correct, see how the double quotes are escape beforehand. echo '<td width="5">Hello</td>'; #Correct, notice how I opened the string with single quotes instead. That way I can use double quotes without the need to escape them. Hope that makes some sense. Oh and one more thing: echo '<td width="5">$variable</td>'; #This will not echo the contents of $variable, instead it will echo the text $variable. This is because any variables wrapped inside single quotes are not parsed. echo '<td width="5">' . $variable . '</td>'; #This will work. Good luck! Link to comment https://forums.phpfreaks.com/topic/129544-dynamic-html-table-problems/#findComment-671640 Share on other sites More sharing options...
Dan_Mason Posted October 22, 2008 Author Share Posted October 22, 2008 Cheers man! no more error messages or syntax problems in the text editor, but the width of the Cell has not actually changed at all! any ideas? thankyou, dan Link to comment https://forums.phpfreaks.com/topic/129544-dynamic-html-table-problems/#findComment-671643 Share on other sites More sharing options...
JasonLewis Posted October 22, 2008 Share Posted October 22, 2008 Depends how long the text is, as well as how long it is in other rows. You have a lot of columns by the look of it. Link to comment https://forums.phpfreaks.com/topic/129544-dynamic-html-table-problems/#findComment-671648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.