Welcome to RCT Portal Web design Internet solutions linux
Search
_TOPICS
Home Your Account FAQ Topics Content Submit News Top 10
  Login/Create an Account    

Modules
· Home
· Downloads
· Feedback
· Forums
· Private Messages
· Recommend Us
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Top 10
· Topics
· Web Links
· Your Account

Who's Online
There are currently, 11 guest(s) and 2 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

Old Articles
Thursday, September 06
· Changing the date and time on linux box
Wednesday, September 05
· Thunderbird is already running...
Sunday, September 02
· Anti spam for exchange 2003
· PSCP the putty secure copy
· things you need to knwo before Buying a domain name
Saturday, September 01
· NVU The open source HTML Development platform
· Nagios monitoring system
Thursday, August 30
· Google Preview
Wednesday, August 29
· Ethereal - A network sniffer
· Live HTTP headers plugin for firefox
· Web application security with paros
· DDOS attacks and BGP
· Monitor network performance and more
Tuesday, August 28
· Perl modules installation
· Finjan Safe Browsing
· Screen saver defragmentation
Monday, August 27
· VI M Text editor
· AnalogX
· Security focus
Thursday, October 22
· */ ?>

Google search
There is a problem right now with this block.

ads
There is a problem right now with this block.

PHP connecting to a mysql server
Posted on Sunday, September 30 @ 13:26:00 IST by admin

Programming languages theog writes "I have been using mysql with PHP for quite a while now and have encountered questions by friends and colleagues regarding how to connect and exactly what needs to be done, the following is a simple example which may put you on track reagrding connecting to a mysql server using PHP.

Well first what I ask myself before deciding to use mysql or any sql for that matter is what am I going to use it for, the answer to this question is the most important question as it will decide how your database scheme will look like, and in some cases even lead you to a track where no sql is needed to accomplish the task you set.

another thing to remember is that PHP must be compiled with mysql support, ( --with-mysql ) and in some case even the libmysqlclient must be installed in order to allow PHP to use mysql properly.

The following is what I use to connect to a mysql server:
mysql_connect("", "", "") or die(mysql_error());
mysql_select_db() or die(mysql_error());

$result = mysql_query("") or die(mysql_error());
$row = mysql_fetch_array( $result );
print $row[''];

In the above lines:
- The host name or ip address of the mysql server.
- The user name to connect to the database with.
- The password for the user above.
- The database to use.
- The sql query itself (i.e. select, insert, update etc...).
- the coulmn to present as a result.

Should you have any further questions, I will be more then happy to reply to them just post a comment with your question.

"

 
Login
Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Related Links
· More about Programming languages
· News by admin


Most read story about Programming languages:
Perl modules installation


Article Rating
Average Score: 0
Votes: 0

Please take a second and vote for this article:

Excellent
Very Good
Good
Regular
Bad


Options

 Printer Friendly Printer Friendly



RCT web design and internet solutions
RCT web development
Page Generation: 0.48 Seconds