Title: PHP Query
Last modified: August 21, 2016

---

# PHP Query

 *  [fernando.azevedo@gmail.com](https://wordpress.org/support/users/fernandoazevedogmailcom/)
 * (@fernandoazevedogmailcom)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/php-query/)
 * Hello dear Sirs!
    I need help I have a function that does the following:
 * 1) Get a number from a rm submitted – ok
    2) Query this number to find a second
   number – ok 3) Add a row on a table and pass the second number. i can add a row,
   but this number2 come as zero in the new row. The other fields are ok.
 *     ```
       $number1= $_POST['item_meta'][434];
          $numero_ntr = $wpdb->get_results(
       	"
       	SELECT meta_value,item_id
       	FROM wp_residuos3frm_item_metas
       	WHERE meta_value = $number1
               AND field_id = '263'
       	"
       );
       // NUMBER2 FROM TABLE:
                     $number2= $numero_ntr->item_id;
   
       // INSERT A NEW ROW ON A TABLE
   
                     $table ='wp_residuos3frm_item_metas';
                     $sim = "Sim";
                     $wpdb->insert(
                     $table,
                     array(
                       'meta_value' => $sim, //OK
                       'field_id' => 340, // OK
                       'item_id' => $number2 // PROBLEM HERE!
                     ),
                     array(
       	        '%s',
       	        '%d',
                       '%s'
                     )
                     );
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been permanently damaged by the forum’s
   parser.]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [fernando.azevedo@gmail.com](https://wordpress.org/support/users/fernandoazevedogmailcom/)
 * (@fernandoazevedogmailcom)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/php-query/#post-4427610)
 * * 1) Get a number from a FORM submitted – ok

Viewing 1 replies (of 1 total)

The topic ‘PHP Query’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [fernando.azevedo@gmail.com](https://wordpress.org/support/users/fernandoazevedogmailcom/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/php-query/#post-4427610)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
