#1
  1. No Profile Picture
    rwiegmann
    Guest
    Devshed Newbie (0 - 499 posts)
    Hi - The following code prints the test message but bombs on the databse selection:

    <HTML>
    <BODY>
    <?
    $host="localhost";
    $user="myuser";
    $password="mypass";
    $mysql_link=mysql_connect ($host,$user,$password) or die("Connection failed");
    print("This is a test");
    $mysql_select_db('joesauto', $mysql_link);
    $query="SELECT * FROM joesauto";
    $mysql_result=mysql_query($query, $mysql_link);
    $mysql_close($mysql_link);
    ?>
    </BODY>
    </HTML>

    Any ideas?
  2. #2
  3. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    I'm guessing that your problem is most likely in the permissions you have set. Check the db table of the mysql database....there should be one entry that has both the database name 'joesauto' and the desired username. Then you'll need to specify a set of privledges for that user.

    Once you are done editing the mysql database you'll need to run 'mysqladmin reload' from the prompt.

    For more information on MySQL's privledge system check out:
    http://www.devshed.com/Server_Side/M...ion/page2.html

    Or the documentation at:
    http://www.devshed.com/Server_Side/M...ivilege_system
  4. #3
  5. No Profile Picture
    rwiegmann
    Guest
    Devshed Newbie (0 - 499 posts)
    Hi My ISP said that these two statements should NOT have a "$" in front:

    $mysql_select_db('joesauto', $mysql_link);
    $mysql_close($mysql_link);

    Does this make sense? It seems to work - but how can I know when to delete these "$" from examples?



    [This message has been edited by rwiegmann (edited 08-26-99).]
  6. #4
  7. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    Yes, I'm sorry I didn't look at your code close enough. Your ISP is right....those two statements should not have dollar signs before them.

Similar Threads

  1. using php to connect to access database
    By Kahless in forum PHP Development
    Replies: 4
    Last Post: January 7th, 2004, 04:59 PM
  2. how can i directly connect to database ...
    By bowlkhin in forum Java Help
    Replies: 0
    Last Post: December 16th, 2003, 08:15 AM
  3. populating a select list wth database info
    By sbongile in forum PHP Development
    Replies: 2
    Last Post: October 22nd, 2003, 06:45 AM
  4. PHP connect to sql database
    By torminator in forum MySQL Help
    Replies: 1
    Last Post: October 15th, 2003, 11:11 AM
  5. connect database with c++
    By gajanan in forum MySQL Help
    Replies: 0
    Last Post: August 28th, 2003, 09:26 AM

IMN logo majestic logo threadwatch logo seochat tools logo