|
||||||
| PHP Tutorials PHP Tutorials |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
Creating a connection between PHP and MySQL is fairly simple. PHP provides all of the functions you need to connect and extract data.
Before we begin have a database setup in MySQL and know the username, password and name of the database. Create a table and add some default values into it. Remember the name of this table. 1) To connect to MySQL you really only need a few variables. To start, open notepad and add these lines: PHP Code:
2) Now we will connect to MySQL using the variables above: PHP Code:
3) Lets pull some data out of our DB. You should have the table name as stated above and I named mine tbl_tutorial so replace this with your table name. We now need to build a query PHP Code:
PHP Code:
5) Display our results PHP Code:
6) Close our connection PHP Code:
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
| Sponsored Links |
|
|
|
|||
|
this code looks good, i think it is what i need. i have followed your previous tutorial, but i did not know how to use the console.... i do not know about the binary settings ...
Quote:
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| John's Java Tutorial Index | John | Java Tutorials | 0 | 01-11-2007 03:05 PM |
| MySQL Resources | dirkfirst | Database & Database Programming | 1 | 05-25-2006 02:31 AM |