MySQL Forums
Forum List  »  Newbie

Re: How to connect from PHP to mysql?
Posted by: Sarabjit Singh
Date: August 20, 2005 08:50AM

You can insert PHP code in your webpage within the tag - <?php ... ?>

To connect to a datase server, use:
$connectionName=mysql_connect($hsotName,$userName,$password);

To select a databse, use:
mysql_select_db($databaseName,$connectionName);

To send a query, use:
$queryResult=mysql_query($query);

To collect and process results, use:
$result=mysql_result($queryResult, $rowNumber, $columnName);

Complete PHP documentation is available at: http://www.php.net/quickref.php

Sarab.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to connect from PHP to mysql?
August 20, 2005 08:50AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.