josh48202 Posted August 18, 2007 Share Posted August 18, 2007 i need help connecting to 1 specific database table im already connected to mysql using this code <?php mysql_connect("localhost", "XXXXX", "YYYYY") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_select_db("VVVVV") or die(mysql_error()); echo "Connected to Database"; ?> what else do i need to connect to the table? Link to comment https://forums.phpfreaks.com/topic/65600-connect-to-database-table/ Share on other sites More sharing options...
Hypnos Posted August 18, 2007 Share Posted August 18, 2007 This is the standard way of getting a result set: mysql_connect("localhost", "XXXXX", "YYYYY"); mysql_select_db("VVVVV"); $result = mysql_query("SELECT * FROM tablename"); while($row = mysql_fetch_assoc($result)) { print $row['columnname']; print $row['columnname2']; } That's all that can be explained in a normal post. For more information, you really have to do research on how MySQL queries are formed and such. http://www.sqlzoo.net/ And there are a billion tutorials on MySQL and PHP. Link to comment https://forums.phpfreaks.com/topic/65600-connect-to-database-table/#findComment-327550 Share on other sites More sharing options...
Orio Posted August 18, 2007 Share Posted August 18, 2007 You can't "connect" to a table. Now that you are connected to a mysql database, you can run various queries on it- including selecting data from a table, inserting or updating the data in the tables, deleting tables and much more. You should read some php+mysql tutorials the will teach you how to do all of the things that I've mentioned above. Just start reading (links). Orio. Link to comment https://forums.phpfreaks.com/topic/65600-connect-to-database-table/#findComment-327552 Share on other sites More sharing options...
josh48202 Posted August 18, 2007 Author Share Posted August 18, 2007 i wanted to connect to the table that stores all the login information for Invision Power Board. Link to comment https://forums.phpfreaks.com/topic/65600-connect-to-database-table/#findComment-327555 Share on other sites More sharing options...
josh48202 Posted August 19, 2007 Author Share Posted August 19, 2007 anyone know how to do that? Link to comment https://forums.phpfreaks.com/topic/65600-connect-to-database-table/#findComment-327878 Share on other sites More sharing options...
dbo Posted August 19, 2007 Share Posted August 19, 2007 As was already mentioned you don't connect to a specific table. You connect to the database and the you run queries on a table. Link to comment https://forums.phpfreaks.com/topic/65600-connect-to-database-table/#findComment-327917 Share on other sites More sharing options...
josh48202 Posted August 19, 2007 Author Share Posted August 19, 2007 ooo alright i got it thx m8 Link to comment https://forums.phpfreaks.com/topic/65600-connect-to-database-table/#findComment-328274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.