Welcome, Guest
  • Author Topic: Do I have my ODBC set up correctly?....  (Read 2586 times)

    Jaylada

    • Seasoned Programmer
    • ***
    • Posts: 144
      • View Profile
      • Email
    Do I have my ODBC set up correctly?....
    « on: 01/04/10, 19:59 »
    I've tried the help files available from my hosting company, and they are not much help........
    Thanks in advance for the help.

    With this file and the applicable other PHP files on my hosting server
    This is how I'm attempting to link to my MySQL database.  I've tried a few variations but so far no luck.  Am I setting up either the PHP file incorrectly or setting up the ODBC connection incorrectly?  I've also tried to put the actual hosting MySQL server location for the DBINFO_HOST variable, that didn't work either

    <?php

    define('DBINFO_HOST', 'localhost');
    define('DBINFO_USER', 'myusername');
    define('DBINFO_PASS', 'thepassword');
    define('DBINFO_DATA', 'ABC_assignedDSN');

    ?>

    ________________________
    on my hosting server: I have assigned the fields as seen below

    ---values                                       ----description
    ABC_assignedDSN                        (DSN Name)
    hostingserver.com                        (Name of server running SQL Server on the network)
    abcd_mainSQLdatabase               (Name of default database for the connection)
    myusername                                 (username for database connection)
    thepassword                                 (password for the connection)







    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Do I have my ODBC set up correctly?....
    « Reply #1 on: 01/05/10, 02:20 »
    two questions:

    if you are running mySQL and accessing it via PHP, why ODBC?
    hoe does your connect command look like?
    happy flashing
    8)
    Ronald

    Jaylada

    • Seasoned Programmer
    • ***
    • Posts: 144
      • View Profile
      • Email
    Re: Do I have my ODBC set up correctly?....
    « Reply #2 on: 01/05/10, 20:38 »
    The simple answer to your question.... I don't know anymore :)

    I've tried such a variety of combination of things to correctly logon, and write to my database, but nothing seems to be working.  I've tried a few things posted online but haven't got those to work either

    I had the ODBC set up when I was trying to use Coldfusion, and I thought it was needed as well for the PHP code that someone sent me, but apparently I was mistaken on that, but thats good to know thanks :)

    ________________________________

    Here is my flashlogin.php file, which the Charles debugger keeps echoing back...Fail
    If you see any problems with this please let me know.... many thanks
    _________________________________
    <?php
    include 'dbinfo.php';

    $connect = mysql_connect(DBINFO_HOST, DBINFO_USER, DBINFO_PASS);
    mysql_select_db(DBINFO_DATA, $connect);

    function assignImages($uid, $arr)
    {
       if($arr == '0')
          return;
          
       $arr = explode(',', $arr);
       foreach($arr as $val)
       {
          $sql = 'INSERT INTO user_images (user_id, image) VALUES ("' . $uid . '", "' .  $_POST['hash'] . '-' . $val . '"); ';
          $row = mysql_query($sql);
       }
    }

    function login($username, $password)
    {
       $sql = 'SELECT id FROM user WHERE username = "'. $username .'" AND password =md5("' . $password . '") LIMIT 1';
       $query = mysql_query($sql);
       $row = mysql_fetch_assoc($query);
       $userid = $row['id'];
       $num = mysql_num_rows($query);
       $imgUp = '0';
       if(isset($_POST['imgUp']))
          $imgUp = $_POST['imgUp'];
          
       if($num > 0)
       {
          echo '&response=1&msg=SUCCESS&username=' . $username . '&userid=' . $userid;
          assignImages($userid, $_POST['imgUp']);
       } else
          echo '&response=0&msg=FAIL';
    }

    if(isset($_POST['username']) && isset($_POST['password']))
    {
       login($_POST['username'], $_POST['password']);
    }else{
       echo '&response=0&msg=NO_INPUT';
    }
    ?>


    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Do I have my ODBC set up correctly?....
    « Reply #3 on: 01/06/10, 02:47 »
    do you have it online for a life visit?
    What does Charles tell you?
    happy flashing
    8)
    Ronald

    Jaylada

    • Seasoned Programmer
    • ***
    • Posts: 144
      • View Profile
      • Email
    Re: Do I have my ODBC set up correctly?....
    « Reply #4 on: 01/07/10, 01:04 »
    The http://www.edeweb.com/UL/UploadExample.html  
    (user and password of 'test' ).

    All Charles says, is that 'test' is  assigned to the correct variables.
    But it returns 'Fail' from the flashlogin.php file

    ______________saw this in the "response headers" section for the flashlogin.php.  Not sure if its significant, but the connection 'close' caught my eye.
       HTTP/1.1 200 OK
    Connection   close
    Date   Thu, 07 Jan 2010 06:04:43 GMT
    Content-Type   text/html
    Server   Microsoft-IIS/6.0
    X-Powered-By   PHP/5.2.11
    X-Powered-By   ASP.NET
    ____________________
    Thanks again for the help
    « Last Edit: 01/07/10, 01:10 by Jaylada »

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: Do I have my ODBC set up correctly?....
    « Reply #5 on: 01/07/10, 03:33 »
    your php sends faile - so it is inside of your php script.
    Try the query inside of phpMyAdmin.

    Check for the logic of you if statements - it looks weird to me.

    It seams you request the imgUp variable to be set, or fail.
    happy flashing
    8)
    Ronald