• Hello, hope you can help me with this. I’m trying to create a page in my wordpress site, which will store information in a separate mysql database from a form. First, I tried to insert the php code to connect to the database, to check if everything’s working, and it works fine.

    The problem starts when I use query to insert info in the database. Let’s say I do this:

    $var = INSERT INTO test (test_1, test_2,…) VALUES (“value_1”, “value_2”,…);

    And when I add that line of code, it just break up. There’s no content at all in the page when I preview everything (I inserted some messages like “Connected!” to check if everything’s okay, and it shows).

    My question is, am I doing something wrong? I don’t really have an specific code at all, I was just testing the plugin… So I would really appreciate if you could help me with this.

    Thanks, and congratulations for making such an amazing plugin.

    https://ww.wp.xz.cn/plugins/insert-php/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter avarela

    (@avarela)

    I forgot to add I’m a novice in programming, so forgive me if I’m doing wrong something obvious…

    Hi Avarela,

    Let me suggest you first develop the code on a separate web page. Simply make a web page developing.php and put the code in there. Use <?php and ?> instead of [insert_php] and [/insert_php]

    Check error logs when something doesn’t work like it should.

    http://php.net/ has examples and documentation.

    When it works on your development page, see
    http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#nonworkingelements
    for specific things that might need to be adjusted to work with Insert PHP.

    Now, give Insert PHP another try.

    Will

    Thread Starter avarela

    (@avarela)

    Thanks Will, I’ll try to develop the code separately, and let’s see if it works.

    Any suggestion about which is the best way to test the php file?

    Best would depend on what you’re testing for.

    Generally, use .php file and start simple. Add to it, testing with each increment. Watch the error logs to catch any warnings and errors and fix them as you go along.

    Will

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Help with SQL query inside insert_php’ is closed to new replies.