Morsusy2k Posted October 23, 2013 Share Posted October 23, 2013 (edited) Okay so I would need to select all tables with prefix 'c' and list their names in php. This is how far i've come: <?php include 'source/connect.php'; $sql3 = "SHOW TABLES FROM mydb LIKE 'c%'"; $result3 = mysql_query($sql3) or die ("Could not access DB: " . mysql_error()); while ($row3 = mysql_fetch_assoc($result2)) { echo $row3; //echoes nothing,how could I echo the table name? }?> Also I would like if that could be done for only first 10 tables. (Only 10 tables select). Edited October 23, 2013 by Morsusy2k Link to comment Share on other sites More sharing options...
justsomeguy Posted October 24, 2013 Share Posted October 24, 2013 Use fetch_array instead of fetch_assoc and then get $row3[0]. If you want to exit the loop after so many iterations then keep a counter and use break to exit the loop. Link to comment Share on other sites More sharing options...
Morsusy2k Posted October 24, 2013 Author Share Posted October 24, 2013 Hehe that was easy,thanks bunch Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now