PHP Help!!

Discussion in 'OT Technology' started by DatacomGuy, Mar 5, 2005.

  1. DatacomGuy

    DatacomGuy is moving to Canada

    Joined:
    Oct 14, 2002
    Messages:
    16,546
    Likes Received:
    0
    Location:
    Tampa, FL
    Installing a script I bought...*clears throat*

    The install script blows. Basically it checks to see if a mysql db exists, if not it creates what is in the config.php file.. if it is supposed to create it.

    So when I run this install script, (no db created yet) it says "Unable to find db "blah" on your mysql server".

    If I go and create it myself, it says "'blah' already exists on your mysql server"..

    :rolleyes: Here is the related script. Anything missing or wrong?

    PHP:
    include ("config.php");
    $connect = @mysql_connect($dbhost$dbuser$dbpasswd);
     IF (!
    $connect)
     {
     echo (
    mysql_error());
     exit();
     }
    IF (
    $database_exists == 0)
    {
    $create_db "CREATE DATABASE $dbname";
    $result = @mysql_query($create_db);
     IF (!
    $result)
     {
     echo (
    mysql_error());
     exit();
     }
    }
    $select_db = @mysql_select_db($dbname);
     IF (!
    $select_db)
     {
     echo (
    mysql_error());
     exit();
     }
    Any thoughts from our PHP geniuses?
     
  2. DatacomGuy

    DatacomGuy is moving to Canada

    Joined:
    Oct 14, 2002
    Messages:
    16,546
    Likes Received:
    0
    Location:
    Tampa, FL
  3. Woodmaster

    Woodmaster New Member

    Joined:
    Dec 25, 2002
    Messages:
    15,448
    Likes Received:
    0
    Location:
    Brasil
    Looks fine, what is it not working or something? Make sure you put in the right db name, user pass, local host and all that in the config file or whatever file stores that.
     
  4. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    Steve, email me tomorrow (monday) if you still haven't figured it out.
     
  5. dk01

    dk01 Awwwwww..... OT Supporter

    Joined:
    Mar 1, 2005
    Messages:
    3,178
    Likes Received:
    0
    Location:
    All up in your interwebsnet.
    Check that you have granted the user permission to view/modify the database. I am assuming you did but I forget this sometimes so I know it can happen.

    -dk
     
  6. DatacomGuy

    DatacomGuy is moving to Canada

    Joined:
    Oct 14, 2002
    Messages:
    16,546
    Likes Received:
    0
    Location:
    Tampa, FL
    Actually, my work PC died, so I'm working on my laptop..lost my contacts. YOU email ME. :p If you don't mind. See PM for address. Still haven't figured it out; however my router is dead at home (great luck this week :rolleyes: ) so I can't SSH in to do it remotely..
     
  7. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
  8. s a x m a n

    s a x m a n New Member

    Joined:
    Nov 16, 2003
    Messages:
    880
    Likes Received:
    0
    take away the @ at the start of the mysql statements so you can see the error messages from mysql ...
     

Share This Page