I’m working on building my own form plugin. I am trying to access the global $wpdb variable but just keep getting this error Warning: require_once(…/…/…/wp-config.php;): failed to open stream: No such file or directory in /app/public/wp-content/plugins/twentyquestions/process-form.php on line 2 I have no idea why I can’t access that variable.
Here is my code.
<?php
require_once(’…/…/…/wp-config.php;’);
require_once(’…/…/…/wp-includes/wp-db.php;’);
if(isset($_POST['q-one-yes'])){
global $wpdb, $table_prefix;
$table_name = $wpdb->prefix . 'form_submission';
$timestamp = current_time( 'mysql' );
$wpdb->insert(
$table_name,
array(
'time_stamp' => $timestamp,
)
);
echo "Working";
}else{
echo "Shits Fucked";
};
Any Help would be amazing. If you need more information let me know thanks!