Jump to content

connect to database table


josh48202

Recommended Posts

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

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.