Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How to use mysql with php?
Old 09-20-2010, 03:41 AM How to use mysql with php?
Junior Talker

Posts: 1
Name: Joe Dale
Trades: 0
My name is Joe Dale coming from Florida. I have installed WAMP and Im using phpExpertEditor. So, I can run any php file, but my problem is that i cant use mysql, and when I'm using related codes, I'm getting Error!

Please help me, I think the problem is due to bad installation of mysql or it is not configured by php...
__________________
Joe Dale

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
joedale is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-20-2010, 06:02 AM Re: How to use mysql with php?
miki86's Avatar
Extreme Talker

Posts: 185
Location: print_r($serbia);
Trades: 0
You dont need to configure anything, when you install wamp it's all set for you.
If you need advanced features then you need to configure.

Maybe you are wrong with the syntax, provide some code so we can help you.
In short you need several steps to work with php and mysql:

Create a connection
Select database
Read/write/update/delete from db
close connection
miki86 is online now
Reply With Quote
View Public Profile
 
Old 09-20-2010, 06:39 AM Re: How to use mysql with php?
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
Don't lie. Your name isn't Joe, and you're not from Florida. Right?
__________________
- Steve

President,
Please login or register to view this content. Registration is FREE
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Old 09-20-2010, 08:10 AM Re: How to use mysql with php?
Junior Talker

Posts: 1
Name: phpdeveloper
Trades: 0
Interacting with MySQL makes PHP a far more powerful tool. In this tutorial we will go through some of the most common ways PHP interacts with MySQL. To follow along with what we are doing, you will need to create a database table by executing this command: CREATE TABLE friends (name VARCHAR(30), fav_color VARCHAR(30), fav_food VARCHAR(30), pet VARCHAR(30)); INSERT INTO friends VALUES ( "Rose", "Pink", "Tacos", "Cat" ), ( "Bradley", "Blue", "Potatoes", "Frog" ), ( "Marie", "Black", "Popcorn", "Dog" ), ( "Ann", "Orange", "Soup", "Cat" ) This will create a table for us to work with, that has friends' names, favorite colors, favorite foods, and pets.

The first thing we need to do in our PHP file is connect to the database. We do that using this code: <?php // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); mysql_select_db("Database_Name") or die(mysql_error()); ?> Of course you will replace server, username, password, and Database_Name with the information relevant to your site. If you are unsure what these values are, contact your hosting provider.

The first thing we need to do in our PHP file is connect to the database. We do that using this code: <?php // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); mysql_select_db("Database_Name") or die(mysql_error()); ?> Of course you will replace server, username, password, and Database_Name with the information relevant to your site. If you are unsure what these values are, contact your hosting provider.
developerphp9 is offline
Reply With Quote
View Public Profile
 
Old 09-20-2010, 02:31 PM Re: How to use mysql with php?
Extreme Talker

Posts: 185
Trades: 0
Php.net/mysql is all the info you will ever need
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
weker is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to use mysql with php?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.91844 seconds with 12 queries