 |
|
 |
 |

10-17-2007, 06:43 PM
|
|
iGuides Addict
|
|
Join Date: Oct 2007
Posts: 83
|
|
Establishing connection with MySQL with PHP
Establishing connection with MySQL with PHP:
==================================
To use MySQL database with your PHP scripting, you must need to establish a connection with database. There are several ways to do it. But, I am explaining here the most simpliest way of connecting with db. Let's assume the filename connect.php
connect.php
Quote:
<?
$dbhost = "localhost";
$dbname = "your_db_name_here";
$dbuser = "db_user_name_here";
$dbpass = "db_password_here";
$con=mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
$db=mysql_select_db($dbname) or die("Could not select db: ".mysql_error());
?>
|
- first of all, declare all the variables dbhost,dbname and dbpass. Basically, in local pc, dbhost is always localhost
- Here mysql_connect() function will create a connection with db
- and mysql_select_db() function will select the db for connection
Note: For further dealing with db in PHP ( insert, update, delete ), you just have to include the file "connect.php".
|

10-17-2007, 07:01 PM
|
 |
Administrator
|
|
Join Date: Sep 2007
Posts: 1,145
|
|
Thanks for the detailed guide, it will really help gaining more knowledge in programming field.
__________________
"Enhance Online Business with iGuides Webmasters and Business Talk"
|

10-18-2007, 07:18 AM
|
|
iGuides Addict
|
|
Join Date: Oct 2007
Posts: 83
|
|
Thank you for your feedback admin. I will try to carry on
|

10-18-2007, 07:37 AM
|
 |
King of the Jungle
|
|
Join Date: Oct 2007
Location: www.travelwitheaseblog.com
Posts: 1,387
|
|
Thanks for sharing this info though i am still learing about php thingy 
|

10-20-2007, 04:15 AM
|
 |
Administrator
|
|
Join Date: Sep 2007
Posts: 1,254
|
|
I am always willing to learn about databases, thank you for the information. However, you have not mentioned anything about Apache.
|

10-20-2007, 08:10 AM
|
|
iGuides Addict
|
|
Join Date: Oct 2007
Posts: 83
|
|
Quote:
Originally Posted by Zafar Ahmed
I am always willing to learn about databases, thank you for the information. However, you have not mentioned anything about Apache.
|
Apache is a web server which is designed to run server-side language like PHP, ASP ( Apache2 is needed ), ASP.NET ( Apache2 is needed ) with mySQL, pgSQL databases. To run Apache with PHP and mySQL. You have to install Apache, PHP and MySQL individually and then configure it. But, I will not go for that way. Because, now there are so many software bundle that installs all the three things ( Apache, PHP and MySQL ) at the same time and there is no need to configure it anymore. Following are some such bundles that you can download for free. Just Download and install it.
Apache2Triad
Apache2Triad Net
XAMPP
apache friends - xampp
PHP Triad
SourceForge.net: PHP Triad for Windows
Thanks to all
|

10-21-2007, 11:20 PM
|
 |
Administrator
|
|
Join Date: Sep 2007
Posts: 1,254
|
|
Quote:
Originally Posted by al-zabir
Apache is a web server which is designed to run server-side language like PHP, ASP ( Apache2 is needed ), ASP.NET ( Apache2 is needed ) with mySQL, pgSQL databases. To run Apache with PHP and mySQL. You have to install Apache, PHP and MySQL individually and then configure it. But, I will not go for that way. Because, now there are so many software bundle that installs all the three things ( Apache, PHP and MySQL ) at the same time and there is no need to configure it anymore. Following are some such bundles that you can download for free. Just Download and install it.
Apache2Triad
Apache2Triad Net
XAMPP
apache friends - xampp
PHP Triad
SourceForge.net: PHP Triad for Windows
Thanks to all
|
Do you have these softwares which installs Apache, PHP and MySQL at the same time and I don't have to configure them out. The download links you gave me seems like its a link to each Individuals.
|

10-22-2007, 06:29 AM
|
|
iGuides Addict
|
|
Join Date: Oct 2007
Posts: 83
|
|
No, Those are not links to each individuals. All of the above three softwares will install Apache, PHP and MySQL at the same time and you don't have to configure them out. Just choose any one of them and feel free to download and install. i will recommend the first one.
Thanks
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 09:54 PM.
|
 |
 |
|
 |
|