Hi, I'm new member I saw this site and it is really interesting , I have new project I worked on it with html and php it is a web site for songs I built the whole site and now start programming the database for singers and songs what I need to ask about is how to start work on data base and connect it with my SQL can you help me? thanksalot

Recommended Answers

All 3 Replies

go to www.php.net for all the little bits of information.
In short you have a host/database/username/password.
you user mysql_connect(host, database, username, password)
then start using mysql_query and mysql_fetch_array for retrieving info

w3schools is a great resource for learning the basics to mySQL databasing with PHP. Here is a link to their tutorials on mySQL in PHP:

http://www.w3schools.com/PHP/php_mysql_intro.asp

Best of luck

Hi, I'm new member I saw this site and it is really interesting , I have new project I worked on it with html and php it is a web site for songs I built the whole site and now start programming the database for singers and songs what I need to ask about is how to start work on data base and connect it with my SQL can you help me? thanksalot

In PHP it's fairly simple to connect to your MySQL database:

//Start by connecting to the database or die showing MySQL Error
 mysql_connect("localhost", "USERNAME", "PASSWORD") or die(mysql_error());

//Next select the database or die again showing the MySQL error
 mysql_select_db("DATABASE NAME") or die(mysql_error());

$result = mysql_query("SELECT * FROM query");  //Perform a query

//Cycle through rows with mysql_fetch_array, passing the query result
 while($row = mysql_fetch_array($result))
 {
    echo "Row: " . $row['column_name'];  //Echo a column from the row
 }

These are the basics to MySQL in PHP. For a more detailed tutorial on MySQL, I would suggest W3Schools MySQL Tutorial. After that, explore the PHP MySQL Tutorial on W3schools for more detailed information. Good Luck...and be sure to post any MySQL or PHP related question to the forums!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.