Please help with PHP and mysql

Discussion in 'PHP' started by surfnearnzone, Jun 16, 2008.

  1. #1
    I am trying to create a simple form with these fields ; Article Title, Article Category, Main Article, Article Tags.

    I don't know any of PHP or mysql so I tried learning from online tutorials but I could'nt get to even connect to database.

    Please help either telling me how to connect to database and create tables in sql, OR let me know how to achieve the above. (Give me the code for it)

    Thanks in advance
     
    surfnearnzone, Jun 16, 2008 IP
  2. frostgiant

    frostgiant Guest

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What I normally do, is use phpMyAdmin. Do you have pMA installed? If, so it is quite easy to make new databases and tables without having sql knowledge. I don't know what system you are on, but using Google you'll quickly find easy to install packages for both windows or linux.

    When you have your database set up with your desired tables you need to make a php connection script, like this standard example from the PHP manual:

    <?php
    $db = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    if (!$db) {
    die('Could not connect: ' . mysql_error());
    }
    ?>


    When you have established a connection to the database you can select a db with "mysql_select_db", and then use the built-in mysql php functions like "mysql_db_query" to process your database fields. You really get all the information by looking at the PHP manual :)
     
    frostgiant, Jun 16, 2008 IP
  3. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #3
    if you have a PC at your home

    download XAMPP and install it


    it just acts a localserver,you can create database and tables in the phpadmin in Xampp,it's the best way to learn mysql and php (Also you can execute scripts in mysql)
     
    Freewebspace, Jun 16, 2008 IP