Support » Fixing WordPress » How to talk to MySQL?

  • 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve looked at the functions section of wordpress but I didn’t find anything. Anyone have an idea? Thanks

    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.

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

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to talk to MySQL?’ is closed to new replies.