Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » connecting mysql database with php
Closed Thread
Old 04-16-2008, 06:35 AM   #1 (permalink)
 
Super Techie

Join Date: Feb 2004

Posts: 442

linux1880 is on a distinguished road

Send a message via Yahoo to linux1880
Default connecting mysql database with php

what is the basic i should know about php when connecting the database ? I have finished studing php but being newbie, I would like ask what should I need to know ? I saw that even application forms on html can be sent to mysql with javascript, can anybody enlight this to me on the basics , any help is appreceated. Thank you.
linux1880 is offline  
Old 04-16-2008, 09:07 AM   #2 (permalink)
murdocsvan's Avatar
 
Ultra Techie

Join Date: Jun 2007

Location: Surrey, UK

Posts: 849

murdocsvan is on a distinguished road

Default Re: connecting mysql database with php

Ask a more specific question and i may be able to help.
__________________

murdocsvan is offline  
Old 04-16-2008, 11:11 AM   #3 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: connecting mysql database with php

Code:
<?php
$host = 'localhost'; // MySQL host name
$user = 'root'; // MySQL database user name
$pass = 'root'; // MySQL database user password
$db = 'dbname'; // MySQL database name

$connect = @mysql_connect ($host,$user,$pass) or die ('Error connecting to database!');

$select = @mysql_select_db ($db) or die ('Error selecting database!');
?>
Now you are connected to MySQL. Save this file as mysql.php or something and include it on every page that needs a MySQL connection.

As for Javascript accessing MySQL, that is called AJAX and you need a pretty good knowledge of Javascript and XML before you get into that.
__________________

Need website help? PM me!
CrazeD is offline  
Old 04-21-2008, 01:34 PM   #4 (permalink)
 
Super Techie

Join Date: Feb 2004

Posts: 442

linux1880 is on a distinguished road

Send a message via Yahoo to linux1880
Default Re: connecting mysql database with php

Thank you,

what i want to know is how html page form submission is going to the database ?
linux1880 is offline  
Old 04-21-2008, 06:22 PM   #5 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: connecting mysql database with php

PHP Tutorial - Forms
PHP Forms
PHPmac - Writing Form Data to a MySQL Database using PHP
__________________

Need website help? PM me!
CrazeD is offline  
Old 04-27-2008, 08:41 AM   #6 (permalink)
willsko87's Avatar
 
Monster Techie

Join Date: Apr 2004

Location: Melbourne, Australia

Posts: 1,219

willsko87 is on a distinguished road

Default Re: connecting mysql database with php

Quote:
Originally Posted by linux1880 View Post
I saw that even application forms on html can be sent to mysql with javascript
As CrazeD mentioned AJAX is an advanced javascript that is usually used to update data from a database without having to refresh the page.
__________________
http://www.aflonline.com.au



willsko87 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restoring my forum from a MySQL backup, I need help! White_Wolf Web Site Hosting / ISP Q & A 2 01-24-2008 07:28 PM
How do I schedule a MySQL database backup? aetherh4cker Programming Discussions 3 01-06-2008 04:33 PM
Mysql and PHP on windows. Driving me mental. dakta Web Site Hosting / ISP Q & A 2 11-07-2007 05:38 AM
New Site Project - Flash + PHP + MySQL + CSS theone_trent Web Graphics, Design, Digital Images 2 06-30-2007 01:12 PM
Database search anshu Browser & General Internet Questions 0 05-29-2007 03:06 AM