Forums

[resolved] Database Password? (4 posts)

  1. rforster
    Member
    Posted 3 years ago #

    Man I feel dumb. I'm trying to access the WP database via some code on a page to pull posts from a select statement. What the heck is my password? (!) I use:
    <?
    $dbh=mysql_connect ("localhost", "Mysite_wrpd1", "PASSWORD")
    or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("Mysite_wrpd1");
    echo "<p>Database selected...\n";

    I have a DB called "lists" with a few tables in it and it lets me do select statements and all is well. Works great. I can't for the life of me remember any other password than the one I use to get into the dashboard.

    Am i missing something here? Or is my database alrady selected and just select from the posts table?

    Thanks!

  2. rforster
    Member
    Posted 3 years ago #

    It appears the connection is still open so if you try to connect it fails.

  3. whooami
    Member
    Posted 3 years ago #

    the connection is open because wordpress is connected. you need to use the new_link parameter. read this more more info:

    http://us.php.net/function.mysql-select-db

  4. rforster
    Member
    Posted 3 years ago #

    Hey thanks for this. Wish I new more about php mysql but for the most part it made sense.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.