WordPress.org

Ready to get started?Download WordPress

Forums

How to talk to MySQL? (5 posts)

  1. tazboy
    Member
    Posted 7 years ago #

    I wanted to make an address book for wordpress. But I need to know how to include database username and password info with the code I make. Like is there an 'include' statement I need to use so that I can upload info to the database?

    Basically, I want to know how to get wordpress to talk to MySQL.

    Thanks for any info.

  2. tazboy
    Member
    Posted 7 years ago #

    I've looked at the functions section of wordpress but I didn't find anything. Anyone have an idea? Thanks

  3. tazboy
    Member
    Posted 7 years ago #

    What would I need to have in my code in order to connect to the wordpress database? I would like to make a static page with header and footer and my address book code. What code would I need? Thanks.

  4. Root
    Member
    Posted 7 years ago #

    You need to consult the php / mysql handbooks / forums / sites.

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    a) Learn SQL.
    b) Learn PHP.
    c) Given A and B, this should tell you exactly what you need to know:
    function demonstration()
    {
    global $wpdb;
    $numposts = $wpdb->get_var("SELECT count(*) FROM $wpdb->posts");
    $postIDs = $wpdb->get_results("SELECT post_id FROM $wpdb->posts");
    $wpdb->query ("UPDATE ".$wpdb->prefix."tablename SET column='value');
    }

    If you don't understand that, you're not ready.

Topic Closed

This topic has been closed to new replies.

About this Topic