You are missing comma end of phone varchar(10) NOT NULL
line, add comma end of line after that table will be created. I have tested https://prnt.sc/qgqmog
function lapizzeria_database() {
global $wpdb;
global $lapizzeria_db_version;
$lapizzeria_db_version = "1.0";
$table = $wpdb->prefix . 'reservation';
$charset_collate = $wpdb->get_charset_collate();
//SQL Statement
$sql = "CREATE TABLE $table (
id mediumint(9) NOT NULL AUTO_INCREMENT,
name varchar(50) NOT NULL,
date datetime NOT NULL,
email varchar(50) DEFAULT '' NOT NULL,
phone varchar(10) NOT NULL,
message longtext NOT NULL,
PRIMARY KEY (id)
) $charset_collate; ";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
add_action('after_setup_theme', 'lapizzeria_database');
Related Posts:
- Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working
- dbDelta not adding additional columns in plugin database update
- dbDelta only creates the last table
- Creating 20,000 Posts or Pages using a .csv file?
- How to properly insert data into custom table via plugin
- How does WordPress handle MySQL row lock errors?
- Searching users with WP_List_Table plugin
- Search and replace text across all posts
- Bad Request (Invalid Hostname) on working server, database problem
- Custom database table for plugin not creating on activation
- Help!! I Screwed up my WP
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Replace existing pages with new pages, keep menu links
- Can I run multiple queries with $wpdb->prepare?
- wordpress in nginx docker container connected to php:8-fpm container and mariadb container isn’t creating any tables on plugin activation
- greatest() function returns undefined property
- Unable to create new database table upon plugin activation using dbDelta
- How to determine what is generating large amount of database queries?
- Get post by ASC from custome field DATE picker
- mysqli_error() expects parameter 1 to be mysqli, null given in own db class
- Display data on Word Press site posts and pages from mysql table
- Help With MySQL to WPDB Query Conversion
- Creating mySQL procedure with $wpdb
- WpDataTables – View Image Directory
- get current date + 90 days and checking every day
- join 2 table orders wordpress plugin
- How do I run SQL queries on a WordPress web page? [closed]
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- WordPress plugin creation how to execute .sql in order to insert multiple rows at activation of plugin
- Enabling WP_USE_EXT_MYSQL to support old plugin
- how to access all user dashboard on fronted page [closed]
- Insert data from .sql file in wordpress plugin
- Automatic switch to backup database on fail
- SQL to order by CPT results by user->display_name w/only user->ID known
- Migrating to WordPress Recipe Plugin and Some SQL Issues
- Enabling plugin failed because MySQL user do not have CREATE permissions
- WordPress page and plugin list using sql query
- Multiple instance of data in plugin custom database table on plugin activation
- WP-DownloadManager – Query most download per week/month etc
- Better ads plugin has 500.000 entries in wp_postmeta
- Errors when trying to use a plugin to write to the database
- _prime_post_caches in wordpress
- pagination on data fetched using SQL query
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- Speeding SQL queries for a large database?
- Cannot get wpdb data (Error in a simple fuction) [closed]
- Mass SQL WordPress Meta Key deletion
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- How can I fetch data from another website to my wordpress website with mysql database
- Getting error “Warning: mysql_query(): Can’t connect to local MySQL server through socket ‘FILEPATH/cccatalog-plugin.php on line 1656”
- DB Query not working in Plugin
- External wpdb connections in different plugins on single page
- Comment Approve – Add custom function when comment is approved
- WordPress plugin: efficient way to store large data
- Plugin generating unexpected output – on WP mysql dump import
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- Can’t create tables with my plugin
- Integrating Custom Database with WordPress
- How to display results from a data table with an encrypted user id?
- Check against server time to display SQL entries – Radio Station DJ Rotator Plugin
- add_action for publish_post doesn’t work
- WordPress Cache delete on plugin uninstall
- how can we migrate wordpress 5.9 website from aws ec2 to new installed wp 5.9 oci compute
- JOIN and SUM different statement results (Mailster Database)
- My CPU usage in A2 Hosting Shared Plan (Turbo Boost) is high due to mysql query!
- Some error in mysql script ? Can’t working to create table
- How to get the custom field value using SQL query
- Memcaching recurring SQL Queries
- Need to know if my approach to designing a geneaology plug-in for wordpress makes sense
- What database state changes happen after a post is manually “updated” with no changes?
- WP Function does not trigger on Webhook API Call
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- How to get database connection details without longing to cpanel in WordPress?
- Performing CRUD operations on front end in wordpress
- Display a number value from mysql query in WP
- WordPress UPDATE queries on MySQL database stuck
- Store GravityForm data in phpmyadmin (mysql)
- WordPress database problem wp_posts, primary key
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- Login issue in WordPress
- get/show Last ID
- HyperDB failover Delay
- Resetting AUTO_INCREMENT primary key
- Re-writing MySQl query for execute faster
- Create Database Tables on Plugin Activation hook
- Write mysql credentials in plugin
- Help with sorting and storing data on WordPress
- Slow WordPress admin panel with a total query time of 1664ms
- Linking Plugin Files to WP
- MySql Query for WordPress
- Using wp config to connect to a DB from a plugin
- What is wrong with this dbDelta syntax?
- How to display blog posts only authored by the administrator
- how to show the data from a myqsl database in a post [closed]
- Post sorting and ordering function in WordPress Admin is broken and always shows post from oldest to newest
- How can I delete the options from DB when the plugin is deleted?
- PHP Creating a formula from mysql db values and db stored math operator
- Getting 504 Gateway Timeout Error on AWS Server! [closed]
- WordPress issue – data is not showing in wp-admin, but when searching through database, all the data is there