【问题标题】:can we give capital letter and underscore in pdo named placeholder我们可以在命名占位符的 pdo 中给出大写字母和下划线吗
【发布时间】:2011-04-11 14:27:42
【问题描述】:

我们能否在 PDO 命名占位符中给出大写字母和下划线。 以下是我的查询:

插入 product_pepe (Type_Class, ID_Alias、Sort_order_Position、 前几天提醒, DaysForNxt疫苗接种, IsSitemapple_IsSitemappable, 无后续疫苗接种, NoOfReminders_NoOfReminders, NoVaccinationsInPacket,RRP_RRP, 提醒间隔,发送提醒电子邮件, 发送提醒短信、特殊说明、 可见,List_price_AUD_gross, Daily_price_dependent,税类, Order_unit, Quantity_for_price, Minimum_order_quantity, IntervalOrder, Reference_unit,Reference_am, Amount_in_product, 制造商, 制造商_product_no, Weight_unit, 重量,长度,高度,宽度, Stock_level、Minimum_stock_level、 DeliveryPeriod, Name_en, Description_en, LongDescription_en, 关键字_zh, IsNew, IsAvailable, 有效日期, 可用性Comment_en, IsBundleProduct,超级产品, SelectedVariations, IsDefault, HasSubOwnPrices, ImageSmall, ImageMedium、ImageLarge、ImageHotDeal、 图像幻灯片字符串,大小, Metalicussize, XXS_XL, EuroSize, AusShoeSize、CLSShoeSize_CLS、 SIZES_SizesXS_XL, SIZES_TTJSize, CristinaRe_Envelopesize, CristinaRe_Paperweight, CristinaRe_packorpersheet, Cristina_Re_DIYsize, Metalicus_Metalicus, EeniMeeniMini Moh_Color, FishLillyBibs_Sizes, Basic_Colours,Basic_Shoesize, Basic_Sizeother2, Basic_toshihatsize, Basic_Sizebymonth, Paperartzi_OobiSize, Paperartzi_Paperartzi, Colors_SolidColors, Colors_StripeColors, ToshiHats_hatsizes、Oobi_StripeColour、 Oobi_OtherColour、Oobi_BlockColour、 Oobi_OobiSize、Oobi_DressColour、 Oobi_MuslinDesigns, Oobi_Designs, DieselShoeSize_ShoeSize, WillowFinn_Sizes, WalnutShoeSize_Shoesize, Bugaboo_BugabooColorBase, Bugaboo_BugabooColorTop, MiniminkSize_MiniminkSize, BuntingPattern_Pattern, Bedding_Bedding) 值 (:Type_Class, :ID_Alias, :Sort_order_Position, :DaysBeforeReminder, :DaysForNxtVaccination, :IsSitemapple_IsSitemappable, :NoFollowUpVaccinations, :NoOfReminders_NoOfReminders, :NoVaccinationsInPacket, :RRP_RRP, :提醒间隔, :SendReminderEmail, :SendReminderSMS, :特别说明, :可见, :List_price_AUD_gross, :Daily_price_dependent, :Taxclass, :Order_unit, :Quantity_for_price, :最小起订量, :IntervalOrder, :Reference_unit, :Reference_am, :Amount_in_product, :制造商, :Manufacturer_product_no, :重量单位,:重量,:长度, :Height, :Width, :Stock_level, :Minimum_stock_level, :DeliveryPeriod, :Name_en, :Description_en, :LongDescription_en, :Keywords_en, :IsNew, :IsAvailable, :有效日期, :AvailabilityComment_en, :IsBundleProduct, :SuperProduct, :SelectedVariations, :IsDefault, :HasSubOwnPrices, :ImageSmall, :ImageMedium, :ImageLarge, :ImageHotDeal, :ImagesSlideShowString, :尺寸, :Metalicussize, :XXS_XL, :EuroSize, :AusShoeSize, :CLSShoeSize_CLS, :SIZES_SizesXS_XL, :SIZES_TTJS大小, :CristinaRe_Envelopesize, :CristinaRe_Paperweight, :CristinaRe_packorpersheet, :Cristina_Re_DIYsize, :Metalicus_Metalicus, :EeniMeeniMini Moh_Color, :FishLillyBibs_Sizes, :Basic_Colours, :Basic_Shoesize, :Basic_Sizeother2, :Basic_toshihatsize, :Basic_Sizebymonth, :Paperartzi_OobiSize, :Paperartzi_Paperartzi, :Colors_SolidColors, :Colors_StripeColors, :ToshiHats_hatsizes, :Oobi_StripeColour, :Oobi_OtherColour, :Oobi_BlockColour, :Oobi_OobiSize, :Oobi_DressColor, :Oobi_MuslinDesigns, :Oobi_Designs, :DieselShoeSize_ShoeSize, :WillowFinn_Sizes, :WalnutShoeSize_Shoesize, :Bugaboo_BugabooColorBase, :Bugaboo_BugabooColorTop, :MiniminkSize_MiniminkSize, :BuntingPattern_Pattern, :Bedding_Bedding)

及其给出以下错误:

Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in D:\Users\avinash\liveprojects\peperatzi\importData\import.php on line 56

这可能是什么原因?

【问题讨论】:

  • Holy.. 你听说过标准化吗?
  • 问题既不是大写字母也不是下划线,是吗? Invalid parameter number: parameter was not defined
  • 是的,我知道,但我必须将这些数据从 csv 导入到一个表中,所以...
  • 如果您从 CSV 导入,您可能想了解 MySQL 的 LOAD DATA INFILE 语法(当然,假设您的数据库是 mySQL)。这比编写 PHP 循环从文件中读取并插入数据库要少得多,而且执行起来也更快。

标签: php oop pdo placeholder


【解决方案1】:

如果您将该语句加载到可识别语法的编辑器中,您会立即发现这里存在问题:

:EeniMeeniMini Moh_Color,

你可能是说

:EeniMeeniMini_Moh_Color,

(Emacs 在暂存缓冲区中为我突出显示了它,因此语法意识并不是绝对必要的。)

【讨论】:

    猜你喜欢
    • 2015-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-08
    • 2021-04-20
    • 2012-01-27
    • 1970-01-01
    相关资源
    最近更新 更多