wordpress query to save in database

Solutions on MaxInterview for wordpress query to save in database by the best coders in the world

showing results for - "wordpress query to save in database"
Camilla
05 Jun 2016
1<?php
2    if (!empty($_POST)) {
3        global $wpdb;
4        $table = 'contact_form';
5        $data = array(
6            'names' => $_POST['yourname'],
7            'emails'    => $_POST['customer_email'],
8            'gender' => $_POST['customer_gender'],
9            'age' => $_POST['customer_age']
10        );
11        //echo "<pre>"; print_r($data);
12
13        $success=$wpdb->insert( $table, $data );
14        if($success){
15            echo 'data has been save' ; 
16        }
17    } else {
18    		echo "data not save";
19    	}
20        ?>
21        <div class="container">
22        	<div class="row ">
23        		<div class="col-md-12 pb-5">
24			        <form method="post">
25			            Your name:<input type="text" name="yourname" id="yourname">
26			            Your Email:<input type="text" id="customer_email" name="customer_email"/><br>
27							Gender:<input type="radio" name="customer_gender" value="male">Male
28								   <input type="radio" name="customer_gender" value="female">Female<br>
29						    Your Age:<input type="text" name="customer_age" id="customer_age"><br>
30						    <input type="submit" name="submit" value="Submit">
31			        </form>
32		        </div>
33	        </div>
34	    </div>
35        
Edison
08 Mar 2020
1<?php
2// 2nd Method - Utilizing the $GLOBALS superglobal. Does not require global keyword ( but may not be best practice )
3$results = $GLOBALS['wpdb']->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_id = 1", OBJECT );
4
Rebeca
01 Jun 2016
1global $wpdb;
2
3$wpdb->insert(
4'table',
5array( 'value' => $value ),
6array( '%s' ),
7);
8
9   
10
11
12
queries leading to this page
backend save data in database wordpressputting datain the database using wordpresswordpress save to databasewordpress save data to database php function wp queryhow to save data to wordpress databasewp do sql query from function get sql query from wp querywpdb select querysave something in database wordpresswordpress form save to databasequery custom database wordpresswordpress query selectwordpress savequerieswordpress query mysql databasesave data into database in wordpress frontendwpdbsecure way to make a sql call using 24wpdb objectwordpress sql getmysql wp db select phpwordpress save data to custom tablewordpress query for fetch data from option tablesave post to database wordpress functionwordpress save custom data to databasehow to save data wordpress dboptions php wordpress save databasewp query examplewordpress forms save to databasephp code to save data from wordpress to databasewp sql querysave files to database wordpresswordpress function to get database infocreate db mysql with 24wpdb classwordpress function sequal querysend database wordpress in phpwp do wpdb querywordpress format sql informationhow to save data in database using wordpresssave data in database using function php in wordpresswp query sqldata base wordpress phpwpdb custome querywordpress function to save in the databasewordpress query to save in databasewordpress save options to databasewordpress plugin save data to databaserequest sql wp querywordpress get global database querywp sql requestwp sql query tutorialsave values in database wordpressuse a custom database in wordpress and use this data in wordpresswordpress save form to databasewordpress query to save in database