Title: Help with SQL query inside insert_php
Last modified: August 31, 2016

---

# Help with SQL query inside insert_php

 *  [avarela](https://wordpress.org/support/users/avarela/)
 * (@avarela)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/help-with-sql-query-inside-insert_php/)
 * 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://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)

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

 *  Thread Starter [avarela](https://wordpress.org/support/users/avarela/)
 * (@avarela)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/help-with-sql-query-inside-insert_php/#post-6906875)
 * I forgot to add I’m a novice in programming, so forgive me if I’m doing wrong
   something obvious…
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/help-with-sql-query-inside-insert_php/#post-6906953)
 * 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/](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](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](https://wordpress.org/support/users/avarela/)
 * (@avarela)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/help-with-sql-query-inside-insert_php/#post-6907004)
 * 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?
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/help-with-sql-query-inside-insert_php/#post-6907035)
 * 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.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

## Tags

 * [forms](https://wordpress.org/support/topic-tag/forms/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [register](https://wordpress.org/support/topic-tag/register/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 4 replies
 * 2 participants
 * Last reply from: [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/help-with-sql-query-inside-insert_php/#post-6907035)
 * Status: not resolved