www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > Dreamweaver/Expression Web

    Dreamweaver/Expression Web or any other WYSIWYG page making software such as GoLive, ImageReady, etc. Discuss them here.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 01-18-2006, 07:00 AM
    kent_will's Avatar
    kent_will kent_will is offline
    xploit
     
    Join Date: May 2005
    Location: Kent, England
    Posts: 48
    Dreamweaver: Linking PHP to MySQL

    Ok, have experience in HTML, design, Java, JavaScript and am no stranger to modern programming languages or SQL. BUT have not ever even seen PHP, or ASP.

    I'm teaching myself PHP and MySQL.

    Have tried to download PHP, Apache and MySQL to no avail. So decided to try Dreamweaver. Connected to my Web Server successfully but have absolutly no idea how to link to a MySQL database. I can write simple PHP but where do I hold my database in the file structure, have created databases using my Hosting control panel but cant find where they are or edit them.

    What I need to know is:
    1) need a program to write MySQL in and dreamweaver cant (could I use a text file though and rename it?

    2) How do i get the PHP code to find and use the database.

    I'm a complete newby to this. Ive written basic SQL at uni but just dont have the software now. and cant remember. think we used PostgreSQL anyway. My knowledge is so patchy, can anyone help??

    Would be much appreciated.

    Will
    Reply With Quote
      #2  
    Old 01-18-2006, 08:59 AM
    knowj knowj is offline
    Registered User
     
    Join Date: Oct 2005
    Location: Nottingham
    Posts: 623
    you can use this code
    Code:
    <?php
    $dblogin = "LOGIN NAME";
    $dbpassword = "PASSWORD";
    $dbname = "DATABASE NAME";
    $dbhost = "localhost"; //usually localhost the sql servers ip address
    $link = mysql_connect($dbhost, $dblogin, $dbpassword)
       or die('Could not connect: ' . mysql_error());
    mysql_select_db($dbname) or die('Could not select database');
    ?>
    or in dreamweaver change your pages filetype to .php then click on the applications tab on the right side menus. click add server (you may need to fill in the details for a testing server etc..)

    i personally perfer to write the code/script myself as dreamweaver doesnt do the best job of it.

    dreamweaver will also write the php for you for many basic serverside tasks using the tabs on this menu
    __________________
    24" iMac (1920x1200), 2.8ghz Intel Core 2 Extreme, 4GB Ram, Mac OS10.5 (Leopard)
    Reply With Quote
      #3  
    Old 01-18-2006, 12:00 PM
    kent_will's Avatar
    kent_will kent_will is offline
    xploit
     
    Join Date: May 2005
    Location: Kent, England
    Posts: 48
    Thanx thats cleard it up, but if I put that in my code, wont people be able to find my password/username when they view code?
    Reply With Quote
      #4  
    Old 01-18-2006, 12:39 PM
    knowj knowj is offline
    Registered User
     
    Join Date: Oct 2005
    Location: Nottingham
    Posts: 623
    no as it is processed serverside so it never reaches the persons browser.


    also its best to have it in a file named whatever you want in a folder which i usually name connections and use the code below to include it into each files you require a database connection

    <?php require_once "connections/filename.php"; ?>
    __________________
    24" iMac (1920x1200), 2.8ghz Intel Core 2 Extreme, 4GB Ram, Mac OS10.5 (Leopard)
    Reply With Quote
      #5  
    Old 01-26-2006, 09:32 AM
    kent_will's Avatar
    kent_will kent_will is offline
    xploit
     
    Join Date: May 2005
    Location: Kent, England
    Posts: 48
    That makes it harder for them to get my Username and password, but whats to stop them looking at the code in the page they are viewing, seeing the path (connections/filename.php) then they download that file i.e. set up a link and save target as. Once they have the php file they can get my username and password by viewing it at their leisure?
    Reply With Quote
      #6  
    Old 01-26-2006, 02:28 PM
    ShrineDesigns's Avatar
    ShrineDesigns ShrineDesigns is offline
    Registered User
     
    Join Date: Dec 2002
    Location: Seattle, WA USA
    Posts: 1,653
    don't use dreamweaver's application panel it is a joke, esp. if you are building web applications
    Reply With Quote
      #7  
    Old 01-27-2006, 08:44 AM
    knowj knowj is offline
    Registered User
     
    Join Date: Oct 2005
    Location: Nottingham
    Posts: 623
    they wont see any of the code.


    no php code is displayed in the pages source as it is all processed serverside.

    user makes request for page > php is processed on server > html is processed by the actions of the php script > html is displayed to the client

    basically they wont be able to see any php you write and the wont be able to get your password etc... without some how hacking/cracking your script which i very much doupt will happen.

    also in the connections folder put a index.html file which is blank/routes the person back to the home page just as an extra precaution. you can also setup other security options on the folder via your host.

    i can using cpanel on my webhost
    __________________
    24" iMac (1920x1200), 2.8ghz Intel Core 2 Extreme, 4GB Ram, Mac OS10.5 (Leopard)
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    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
    Forum Jump


    All times are GMT -5. The time now is 04:17 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.