dennismonsewicz Posted September 9, 2009 Share Posted September 9, 2009 I have the following loop: mysql_connect('localhost', '*****', ''*****'); mysql_select_db(''*****'); $q = mysql_query("SHOW TABLES FROM tblName"); while($row = mysql_fetch_array($q)) { $col = $row; $count = count($col); for($i = 0; $i < $count; $i++) { echo '<span>' . $col[$i] . '</span>'; } } When you run the code it adds an extra span tag in there... I can't figure out why! Quote Link to comment Share on other sites More sharing options...
SilveR316 Posted September 9, 2009 Share Posted September 9, 2009 What's value inside the span in your output? Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 9, 2009 Author Share Posted September 9, 2009 a table name from my database Quote Link to comment Share on other sites More sharing options...
SilveR316 Posted September 9, 2009 Share Posted September 9, 2009 I meant in the extra span. Are any of the names being duplicated? Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 9, 2009 Author Share Posted September 9, 2009 oh gotcha... no its just a blank span for some reason Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 9, 2009 Author Share Posted September 9, 2009 figured it out fixed code: mysql_connect('localhost', '*******', '*******'); mysql_select_db('*******'); $q = mysql_query("SHOW TABLES FROM *******"); while($row = mysql_fetch_array($q)) { $col = $row; $count = count($col) - 1; for($i = 0; $i < $count; $i++) { echo '<span>' . $col[$i] . '</span>'; } } Quote Link to comment Share on other sites More sharing options...
SilveR316 Posted September 9, 2009 Share Posted September 9, 2009 I see it now. You could also have started your $i at 1 instead of 0. Quote Link to comment 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.