Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save developer-anuragsingh/0d2d58badacc35e5aec0 to your computer and use it in GitHub Desktop.
Save developer-anuragsingh/0d2d58badacc35e5aec0 to your computer and use it in GitHub Desktop.
/** Error reporting */
global $wpdb;
$wpdb->show_errors();
// For WordPress Multisite, you must define the DIEONDBERROR constant for database errors to display
define( 'DIEONDBERROR', true );
/** Error reporting */
$table = $wpdb->prefix . "report_performance";
$charset_collate = $wpdb->get_charset_collate();
$createTable = "CREAT TABLE IF NOT EXISTS $table (
ID INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
stockID VARCHAR(12) NOT NULL,
stockName VARCHAR(50) NOT NULL,
action VARCHAR(12) NOT NULL,
entryDate VARCHAR(12) NOT NULL,
exitDate VARCHAR(12) NOT NULL,
entryPrice VARCHAR(12) NOT NULL,
exitPrice VARCHAR(12) NOT NULL,
targetPrice VARCHAR(12) NOT NULL,
stopLoss VARCHAR(12) NOT NULL,
callStartDate TIMESTAMP
)$charset_collate;";
// Check if database is created
if($wpdb->query($createTable) === TRUE)
{
echo "table created successfully.";
}
else {
echo $wpdb->print_error();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment