$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>plugins - No result after wpdb->insert|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

plugins - No result after wpdb->insert

matteradmin8PV0评论

I have implemented my own plugin (PHP file). It contains a form with questions with input type = radio. I want to submit the answers and load them into the database. My action is calling another PHP file (which gets found properly). However, the browser cannot load anything. After hours of research I found out that my wpdb query stops the procedure, but what am I doing wrong?

<?php

//Collecting info
$name = $_POST['name'];
$movie = $_POST['movie'];

//Check if we have all input fields (function does not need check)
if(empty($name)){
    die("Please Choose A Name! <a href='javascript:history.back()'>Back</a><br>");
}
if(empty($movie)){
    die("Please Choose your favourite Movie! <a href='javascript:history.back()'>Back</a><br>");
}

//Load answers to database
global $wpdb;
$table = $wpdb->prefix . 'themovies';
$wpdb->insert($table, array('Name' => $name, 'Movie' => $movie), array('%s', '%s'));

if($insert == true){
    header("location: thankyou.php");
    exit;
}
else
{
    echo "Error";
}
?>

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far