Results 1 to 9 of 9
  1. #1
    PHP / mySQL Project help

    Member Since
    Feb 09, 2005
    Posts
    841
    PHP / mySQL Project help
    Hey everyone,

    I have a project that I got to get done. Its work related to I cant go into to much detail. Its pretty basic actually I just need someone to tell me what exactly I need.

    Ok, I have an .exe file (I know this is mac-forums!) that queries an Access Database. So, I am going to take the database from there.

    I have to just integrate it into a webpage.... It should just be a basic page that can query the DB etc.

    Can anyone tell me what exactly I need.

    Im guessing I just need a little PHP.. and I assume it isnt anything major.
    Im sure I could create maybe some sort of a barebones page and "Skin" it?

    All help greatly appreciated!

    Thanks

    iRock

  2. #2
    PHP / mySQL Project help

    Member Since
    Feb 09, 2005
    Posts
    841
    Bump...... anyone able to help me out?

  3. #3
    PHP / mySQL Project help

    Member Since
    Oct 07, 2005
    Location
    Seattle
    Posts
    346
    Specs:
    MBP CD 1.83/2ghz/7200 100g + Mini 2ghz C2D 2gb + Mini 1.42ghz G4 + PM 7200/120 + Newton OMP
    PHP is great for this because of its built-in (if you compile it that way) mysql (and/or Oracle) libraries and functions. Before I started playing with PHP, I downloaded the DBI and DBD::mysql perl libraries and wrote some simple CGI code for pulling information from a mysql database and displaying it onto a webpage.

    I can't help a whole lot beyond that since my time constraints prevented me from getting too far, but I can probably post a little bit of sample code if you want to see how to get started... (Although my PHP scripts are for work and so they're all speaking Oracle -- the mysql stuff I've done on my MBP are written in perl).

  4. #4
    PHP / mySQL Project help

    Member Since
    Feb 09, 2005
    Posts
    841
    Hey, thanks for the reply. yeah that would be great if you could do that. If its not too much bother that is. Thanks alot!

  5. #5
    PHP / mySQL Project help
    Thyamine's Avatar
    Member Since
    Apr 23, 2007
    Location
    Coatesville, PA
    Posts
    377
    Specs:
    MBP 15", 2.33 GHz, 2Gb
    Here are some links that should help as well:

    PHP and ODBC: http://www.w3schools.com/php/php_db_odbc.asp

    PHP and Access: http://aspn.activestate.com/ASPN/Coo.../Recipe/163447

    Access ODBC and PHP: http://www.phpfreaks.com/tutorials/61/0.php

    Edit: And one question I should have asked: Your title says MySQL, but you only mention Access. Where does the MySQL come in?

  6. #6
    PHP / mySQL Project help

    Member Since
    Feb 09, 2005
    Posts
    841
    Thanks alot Thymine. Ill check those out now.
    Actually the mySQL side of things I also have to apply the same principle to a mySQL database.

  7. #7
    PHP / mySQL Project help
    Thyamine's Avatar
    Member Since
    Apr 23, 2007
    Location
    Coatesville, PA
    Posts
    377
    Specs:
    MBP 15", 2.33 GHz, 2Gb
    The concept is the same for all databases, with some caveats thrown in here and there. Connection strings will be different, syntax for queries may be different, things like that.

    Usually once you do it a handful of times it's no big deal anymore. Open connection, send query, receive results, process results.

  8. #8
    PHP / mySQL Project help

    Member Since
    Feb 09, 2005
    Posts
    841
    Cool! Thanks. I appreciate all the help!

  9. #9
    PHP / mySQL Project help

    Member Since
    Oct 07, 2005
    Location
    Seattle
    Posts
    346
    Specs:
    MBP CD 1.83/2ghz/7200 100g + Mini 2ghz C2D 2gb + Mini 1.42ghz G4 + PM 7200/120 + Newton OMP
    For what it's worth, here's a very simple snippet of code I just hacked together. This takes a few parameters pushed to it by way of wget (which, if you're not familiar with, is a way of emulating a web browser in code to pass a URL to a server and retrieve any html pushed from that server). It takes the passed parameters and loads them into a local mysql database. You should be able to use this to see a very simple way of putting data in to your database. Getting it out is slightly more complicated, but not much...

    Code:
    <?PHP
    
    $server=$_GET['server'];
    $sessioncnt=$_GET['sessioncnt'];
    $totalsessions=$_GET['totalsessions'];
    $date=date('Y-m-d H:i:s');
    
    $db_conn = mysql_connect('localhost', 'username', 'password');
    if (!$db_conn) {
        die('Could not connect: ' . mysql_error());
    }
    
    $db_selected = mysql_select_db('database_name', $db_conn);
    if (!$db_selected) {
        die ('Can\'t use database_name : ' . mysql_error());
    }
    
    $insert=sprintf("insert into session_history values('%s','%s',%d,%d)",
            mysql_real_escape_string($server),
            mysql_real_escape_string($date),
            $sessioncnt, $totalsessions);
    
    mysql_query($insert,$db_conn);
    mysql_close($db_conn);
    
    ?>

    The way this script is called is by running the following command:

    Code:
    wget -q --delete-after "http://web_url/~user/path/scrpt.php?server=${hostname}&sessioncnt=${usedprocs}&totalsessions=${maxprocs}"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP and MySQL
    By conor in forum OS X - Operating System
    Replies: 5
    Last Post: 06-11-2009, 07:44 PM
  2. A little help with PHP/MySQL
    By blinkdude182 in forum Web Design and Hosting
    Replies: 4
    Last Post: 02-08-2009, 01:52 AM
  3. Help with b2evolution php/mySQL
    By indykid in forum Web Design and Hosting
    Replies: 0
    Last Post: 06-07-2005, 02:49 PM
  4. PHP mysql
    By richardmojo in forum Web Design and Hosting
    Replies: 2
    Last Post: 05-09-2005, 10:05 PM
  5. PHP+MySQL Help.
    By design2 in forum Web Design and Hosting
    Replies: 3
    Last Post: 08-07-2004, 06:22 PM

Posting Permissions

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