• I’ve created my own template page which I am attempting to insert into the database from. I’m able to read from custom tables I created in the WP database, but I haven’t been able to write to it yet.

    I’m new to PHP.

    I’m using the mysql_real_escape_string example on the php.net site to insert into the db.

    I’m using Example #3 A “Best Practice” query.

    The example begins with the following.
    $link = mysql_connect(‘mysql_host’, ‘mysql_user’, ‘mysql_password’);

    I assume I’m already connected to the db because I can read from it on the same page. I also assume this connection is made through <?php get_header(); ?>.

    Since I don’t need to connect to the db again how do I call the mysql_connect variable to verify that it is still connected, catching errors and inserting properly? I’ve tried the variable $this but it doesn’t seem to work.

    Thanks for your help!

  • The topic ‘writing to a custom wp table. mysql_connect variable name?’ is closed to new replies.