Home   Help Login Register  
Welcome, Guest. Please login or register.

Login with username, password and session length

Search
Free Website WooThemes - Quality Themes, Great Support
Pages: [1]   Go Down
Print
Topic: PHP MySQL Example - PHP MySQL sample connection Tutorial  (Read 1274 times)
« on: August 18, 2008, 12:32:41 PM »
Kevin Offline
Newbie

View Profile
*

iTrader: 2
Posts: 72



If you are facing trouble to connect to your MySQL database you can use the following code to check the database connection:
Code:
<?php
$dbhost 
'localhost';   // Your MySQL server host
$dbuser 'dbuser';         // MySQL database user
$dbpass 'password'// Password for MySQL database User

$conn mysql_connect($dbhost$dbuser$dbpass) or 
die (
'Error connecting to mysql');
$dbname 'database_name';
mysql_select_db($dbname);
?>

Regards,

Kevin

Share this topic on AskShare this topic on BlinkbitsShare this topic on BlinklistShare this topic on BloglinesShare this topic on BmarksShare this topic on Del.icio.usShare this topic on DiggShare this topic on DzoneShare this topic on FacebookShare this topic on Feed Me LinksShare this topic on FurlShare this topic on GoogleShare this topic on LiveShare this topic on MagnoliaShare this topic on MySpaceShare this topic on NetvouzShare this topic on NewsvineShare this topic on OneviewShare this topic on RedditShare this topic on RojoShare this topic on ScuttleShare this topic on ShadowsShare this topic on SlashdotShare this topic on SpurlShare this topic on SquidooShare this topic on StumbleUponShare this topic on TechnoratiShare this topic on TwitterShare this topic on TipdShare this topic on YahooShare this topic on Google buzz
Logged
« Reply #1 on: October 21, 2010, 04:44:21 PM »
kapukteam Offline
Newbie

View Profile
*

iTrader: 0
Posts: 5



php and mysql are most important
php is as your design
mysql is as your database

you can learn php quickly
dont worry
Logged
« Reply #2 on: December 22, 2011, 05:22:05 AM »
wilsondavid Offline
Newbie

View Profile
*

iTrader: 0
Posts: 5



PHP - MYSQL connection :

<?

$link = mysql_connect(" localhost "," root ","");

mysql_select_db("sample",$link);

$result=mysql_query(" SELECT * from employee;");

?>
Logged

Pages: [1]   Go Up
Print
Jump to:  

Untitled Document
(c) 2010 HELM, WHM, cPanel, ASP, .Net development, PHP, MySQL, MSSQL Server, SEO support forum
Powered by SMF 1.1.16 | SMF © 2011, Simple Machines | Forum style designed by PixelSlot
Web Hosting - Sitemap - XML Sitemap