mr cracker Posted May 2, 2010 Share Posted May 2, 2010 Hello. i have this code: $tabla="tbl_familias"; //NOMBRE DE LA TABLA A MOSTRAR $result = mysql_query("select * from $tabla"); echo "<table bgcolor=\"#DBEDE9\" align=center style=\"border:5px outset green\">"; for ($i = 0; $i < mysql_num_fields($result); $i++) { print "<th>".mysql_field_name($result, $i)."</th>\n"; } while ($registro = mysql_fetch_row($result)) { echo "<tr>"; foreach($registro as $clave) { echo "<td bgcolor=\"white\"style=\"border:2px groove black\" align=\"center\">",$clave,"</td>"; } } echo "</tr></table>"; i get this table: but its too small, and i want to make it bigger / wider. I've tried using width like this: echo "<table bgcolor=\"#DBEDE9\" align=center width="600" style=\"border:5px outset green\">"; but i get: Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/200478-make-table-wider/ Share on other sites More sharing options...
Alex Posted May 2, 2010 Share Posted May 2, 2010 You have to escape the quotes. echo "<table bgcolor=\"#DBEDE9\" align=center width=\"600\" style=\"border:5px outset green\">"; Quote Link to comment https://forums.phpfreaks.com/topic/200478-make-table-wider/#findComment-1052018 Share on other sites More sharing options...
mr cracker Posted May 2, 2010 Author Share Posted May 2, 2010 Thank you, its working nicely now. I'm a begginer. Why do i have to "escape" them ? Quote Link to comment https://forums.phpfreaks.com/topic/200478-make-table-wider/#findComment-1052025 Share on other sites More sharing options...
Alex Posted May 2, 2010 Share Posted May 2, 2010 To open and close the echo you're using double quotes, so if you want to use double quotes anywhere inside of the string you must escape them, so it doesn't think you want to stop the echo there. Quote Link to comment https://forums.phpfreaks.com/topic/200478-make-table-wider/#findComment-1052028 Share on other sites More sharing options...
mr cracker Posted May 2, 2010 Author Share Posted May 2, 2010 ok, now i get it. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/200478-make-table-wider/#findComment-1052036 Share on other sites More sharing options...
Alex Posted May 2, 2010 Share Posted May 2, 2010 By the way, when a topic is solved we appreciate it if you mark it as such. There's a button at the bottom of the page to do so. Quote Link to comment https://forums.phpfreaks.com/topic/200478-make-table-wider/#findComment-1052038 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.