Results 1 to 5 of 5

Thread: mySQL connection with Dreamweaver/Frontpage

  1. #1
    Join Date
    Aug 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default mySQL connection with Dreamweaver/Frontpage

    Running XP Pro... Using mySQL/PHP and running both Dreamweaver and Frontpage. Trying to figure out what is the best program to use and the best way to connect to mySQL...Any help would be greatly appreciated...

  2. #2
    Join Date
    Aug 2006
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm running XP Pro and I have both Dreamweaver and Frontpage 2003, too. And I tell you Dreamweaver is much better than Frontpage, especially the version I have(MX). When you're saying which is the best way to connect with MySQL, what do you mean? The best code to do so or how to put the code togother to be easier to read(and so easier to find errors).

    The code I use to do so is:

    Code:
    <?    /php open tag
    $conn = mysql_connect("somehost", "username", "somepass");  /function to connect to MySQL
    mysql_select_db("somedatabase", $conn); /function to select database from MySQL
    $sql = "CREATE TABLE testTable (id int not null primary key auto_increment, testField varchar(100))"; /construction of the command of MySQL
    $sql_res = mysql_query($sql, $conn); /execution of the command
    ?> /php end tag
    Now, as for how to put the code together:

    It's good to create your own functions. For example, create one function that connects to MySQL and selects one database. Here's an example:

    Code:
    <?
    function doDB() /function that connects to MySQL and selects a database
    {
    global $conn;
    $conn = mysql_connect("somehost", "username", "somepass");/connection to MySQL
    mysql_select_db("somedatabase", $conn); /selection of a database
    }
    
    function CreateTable($tablename) /function that creates a table in a database with the name given from the user
    {
    global $sql_res;
    $sql = "CREATE TABLE $tablename (id int not null primary key auto_increment, testField varchar(100))";
    $sql_res = mysql_query($sql, $conn);
    }
    
    /calling of the functions
    doDB();
    CreateTable("testTable");
    ?>
    However, there a lot to learn about MySQL and PHP. Here's a book that helped me A LOT:


    • Teach Yourself PHP, MySQL and Apache, All In One - Julie C. Meloni (A really good book)


    Also, I have two other books in PDF and some other tutorials - Give me your email to send you that information.

    Hope I Helped!!!!
    Last edited by costas; 08-27-2006 at 10:51 AM.

  3. #3
    Join Date
    Jan 2007
    Location
    Indonesia
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am a bit new with web, is it possible to use frontpage while the host have mySQL and frontpage extension ? I would appreciate if you could send me all info to my email. Thanks before

  4. #4
    Join Date
    Aug 2006
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OK, Herry, I'll send them to you!
    Last edited by costas; 01-30-2007 at 04:16 PM.

  5. #5
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Just be warned about Frontpage AND Dreamweaver. Both will add things to your scripts/pages, and sometimes you will never notice, other times your items will not work.

    If you do not know how to code this all by hand yourself, then you won't be able to fix the problems (when and if they arrive).

    I don't endorse either, but I know a lot of people learn by using them, so I don't hate them either. I just suggest you learn how to do it in a plain text editor (like notepad, etc).

    If you can understand enough to do that much then you can easily understand the "extras" that DW and FP put in there, and thus, how to correct them.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •