Backticks (`) Instead of Single Quotes (‘) in an SQL Statement?

Question

I have this code which is partially shown here for brevity:

global $wpdb;
// creates jwp_bids in database if not exists
$table = $wpdb->prefix . "jwp_bids"; 
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE IF NOT EXISTS $table (
    `id` mediumint(9) NOT NULL AUTO_INCREMENT,
    `bid_amt` text NOT NULL,

When I originally typed the code, I used ' within the parentheses and the code would not run.

I then changed the Single Quote to a Backtick and the code ran perfectly.

Would someone please explain:

  • What is the proper term for the oddball quotes 🙂
  • Why are they used instead of ‘ ?
  • Is this only pertinent to MySQL? WP? Php?
  • Where can I find a technical reference for this sort of thing so I don’t have to bug you fine folk?
0
james 6 years 2017-01-04T16:33:46-05:00 0 Answers 84 views 0

Leave an answer

Browse
Browse