PHP simple application with MYSQL

Asked By 40 points N/A Posted on -
qa-featured

Hello Techyv Guys,

I need to have a sample coding for any PHP simple application with MYSQL connectivity. I need to have the coding in order to understand the connectivity coding of PHP with MYSQL. Please help me by providing me the same, if anyone can also provide any related article link, that will also help me.

Regards,

Michael D Dent

SHARE
Best Answer by Waters Magner
Answered By 0 points N/A #170067

PHP simple application with MYSQL

qa-featured

PHP is a major language used in creating websites. And it uses the MySQL connectivity. MySQL is an open source database, which allows multi users to perform multiple actions. An advantage of building a website on a database is that you can run search queries on the database which would not be possible in case of html written website.

Here is a simple code of PHP with MySQL database.

You can look here for coding and articles/tutorials.

Best Answer
Best Answer
Answered By 0 points N/A #170068

PHP simple application with MYSQL

qa-featured

Hi,

MySQL connectivity in PHP is quite straightforward. You need to connect to the MySQL at first. Then you need to choose the database. Then,you will have to mention the query and finally you need to fetch the data from the query. There is one more step as you need to close the connection finally. This seems to be quite similar to database connectivity in any other database software. However, in this case you need a simple connection string. You need to use following code:

<?PHP 

$username= "user_name";

$password="password";

$hostname="Local_Host";  

$dbHandle=myql_connect($hostname,$username,$password); … ?>

You can add any message for connection failure and success.

For selecting database you need to use mysql_select_db. You can compose query using mysql_query. You can fetch the data from query using mysql_fetch_array. You can close the database connection using mysql_close. This is the fundamental aspect. Now you can read a lot and do wonders using MySQL and PHP.

Database-connectivity-for-mysql-and-PHP

Waters Magner

Login/Register to Answer

Related Questions