techker Posted December 1, 2008 Share Posted December 1, 2008 hey guys can i select all in a databases? i want to show all tables created.. Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/ Share on other sites More sharing options...
gevans Posted December 1, 2008 Share Posted December 1, 2008 <?php $mysql_access = mysql_connect("localhost", $user, $pw); mysql_select_db($db, $mysql_access); $result = mysql_query("SHOW tables", $mysql_access); while($row = mysql_fetch_row($result)) { print("$row[0]<br>"); } ?> Never used this before but looks like what you need Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703109 Share on other sites More sharing options...
techker Posted December 1, 2008 Author Share Posted December 1, 2008 it dosnt work it gives me an access denied all the time..i have changed all the info to my server. i removed to test $mysql_access and still nothing Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703140 Share on other sites More sharing options...
gevans Posted December 1, 2008 Share Posted December 1, 2008 <? $showtablequery = "SHOW TABLES FROM [your database name here]"; $showtablequery_result = mysql_query($showtablequery); while($showtablerow = mysql_fetch_array($showtablequery_result)) { echo $showtablerow[0]."<br />"; } ?> try it like that if you like, that may you dont have to worry about assigning your connection, just put your database name in the right place Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703152 Share on other sites More sharing options...
techker Posted December 1, 2008 Author Share Posted December 1, 2008 <? $showtablequery = "SHOW TABLES FROM [your database name here]"; $showtablequery_result = mysql_query($showtablequery); while($showtablerow = mysql_fetch_array($showtablequery_result)) { echo $showtablerow[0]."<br />"; } ?> try it like that if you like, that may you dont have to worry about assigning your connection, just put your database name in the right place Warning: mysql_query() [function.mysql-query]: Access denied for user 'soul3438'@'localhost' (using password: NO) in /home/soul3438/public_html/Gymgraph/show.php on line 4 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/soul3438/public_html/Gymgraph/show.php on line 4 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/soul3438/public_html/Gymgraph/show.php on line 5 Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703155 Share on other sites More sharing options...
gevans Posted December 1, 2008 Share Posted December 1, 2008 have you connected to your database yet?? post all your code Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703161 Share on other sites More sharing options...
techker Posted December 1, 2008 Author Share Posted December 1, 2008 <? mysql_connect("localhost", "user_techker", "pass"); mysql_select_db("soul3438_gymgraphtrainers"); $showtablequery = "SHOW TABLES FROM [soul3438_gymgraphtrainers]"; $showtablequery_result = mysql_query($showtablequery); while($showtablerow = mysql_fetch_array($showtablequery_result)) { echo $showtablerow[0]."<br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703167 Share on other sites More sharing options...
gevans Posted December 1, 2008 Share Posted December 1, 2008 <?php mysql_connect("localhost", "user_techker", "pass"); mysql_select_db("soul3438_gymgraphtrainers"); $showtablequery = "SHOW TABLES FROM soul3438_gymgraphtrainers"; $showtablequery_result = mysql_query($showtablequery); while($showtablerow = mysql_fetch_array($showtablequery_result)) { echo $showtablerow[0]."<br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703171 Share on other sites More sharing options...
techker Posted December 1, 2008 Author Share Posted December 1, 2008 <?php mysql_connect("localhost", "user_techker", "pass"); mysql_select_db("soul3438_gymgraphtrainers"); $showtablequery = "SHOW TABLES FROM soul3438_gymgraphtrainers"; $showtablequery_result = mysql_query($showtablequery); while($showtablerow = mysql_fetch_array($showtablequery_result)) { echo $showtablerow[0]."<br />"; } ?> All good thx!! Quote Link to comment https://forums.phpfreaks.com/topic/135004-select-question/#findComment-703179 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.