语法:创建表'变量'

时间:2017-04-06 18:11:56

标签: php mysqli

在这个领域有很多方法可以使用变量,但变量的这个位置似乎与我在下面写的语法一起工作。除此之外,它没有。

namespace Maintenance.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;

    public partial class AppVersion
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public AppVersion()
        {
            this.Companies = new HashSet<Company>();
        }

        [StringLength(40)]
        [Display(Name = "App Version")]
        public string AppVersion1 { get; set; }
        [StringLength(40)]
        [Display(Name = "App Version Description")]
        public string AppVersionDescription { get; set; }
        [ReadOnly(true)]
        [Display(Name = "Creating Date")]
        public System.DateTime CreateDate { get; set; }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Company> Companies { get; set; }
    }
}

1 个答案:

答案 0 :(得分:0)

试试这个: (摆脱变量周围的引号和双引号 - &gt;名称)

$sql = "CREATE TABLE $name (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, 
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP
)";