×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

New in PHP / MySQL how to Begin
4

New in PHP / MySQL how to Begin

New in PHP / MySQL how to Begin

(OP)
Hello PHP Boys & Girls,

I like to begin in PHP and connect some things with a MySQL database. What is the best way to begin and of course do you know good site's, manuals or turtorials for that kind of things. I have the MySQL manual and PHP manual already, they are good, but maybe you know some better stuff.

Thanks for all reactions,

Qwark

RE: New in PHP / MySQL how to Begin

I have only started php + mySQL recently like you but have found these sites a good beginning,

http://echodev.com/tutorials/php/basics/index.shtml
http://www.devshed.com/Server_Side/PHP/Introduction/
http://www.devshed.com/Server_Side/MySQL/Intro/page2.html

I think asking in the forums can be even more helpfull though!

Hope these help.

Chris MacPherson
thedamager@hotmail.com
www.macpweb.org
Bring on the new Browza's!!

RE: New in PHP / MySQL how to Begin

3
I believe there is a FAQ on how to do this for the PHP forum.

If not, here is the code to connect to a mySQL database:

$dbhost = "localhost"; // your host name here
$dbuser = "username"; // your mysql username
$dbpass = "password"; // your mysql password

$conn = mysql_connect($dbhost,$dbuser,$dbpass);
if (!$conn) {
    print "Failed to connect to database.\n";
} else {
    print "Connected to database.\n";
}


 
In order to insert stuff into a database, you have to know some SQL.

For example, you would add the value "stuff" into a table named "table" in a database named "database" into a field named "field".

This is how you would do it:
$db = "database"; // the name of the database
$insert = "INSERT INTO table (field) VALUES 'stuff'";
$add = mysql($db,$insert);
if (!$add) {
    print "failed to add data.\n";
} else {
    print "data added successfully.\n";
}



I think that should do it.

Hope this helps,

-Vic

vic cherubini
malice365@hotmail.com
www.epicsoftware.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====

RE: New in PHP / MySQL how to Begin

(OP)
Thanks guys i think your tips are very helpful for me

Qwark

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close