<i id='GNo2m'><tr id='GNo2m'><dt id='GNo2m'><q id='GNo2m'><span id='GNo2m'><b id='GNo2m'><form id='GNo2m'><ins id='GNo2m'></ins><ul id='GNo2m'></ul><sub id='GNo2m'></sub></form><legend id='GNo2m'></legend><bdo id='GNo2m'><pre id='GNo2m'><center id='GNo2m'></center></pre></bdo></b><th id='GNo2m'></th></span></q></dt></tr></i><div id='GNo2m'><tfoot id='GNo2m'></tfoot><dl id='GNo2m'><fieldset id='GNo2m'></fieldset></dl></div>

<small id='GNo2m'></small><noframes id='GNo2m'>

    <tfoot id='GNo2m'></tfoot>

      • <bdo id='GNo2m'></bdo><ul id='GNo2m'></ul>

        <legend id='GNo2m'><style id='GNo2m'><dir id='GNo2m'><q id='GNo2m'></q></dir></style></legend>

        插入日期的php/Mysql查询失败

        php/Mysql query with inserting date fails(插入日期的php/Mysql查询失败)
              <legend id='oBcis'><style id='oBcis'><dir id='oBcis'><q id='oBcis'></q></dir></style></legend>
            1. <small id='oBcis'></small><noframes id='oBcis'>

                  <tbody id='oBcis'></tbody>

              • <tfoot id='oBcis'></tfoot>
                <i id='oBcis'><tr id='oBcis'><dt id='oBcis'><q id='oBcis'><span id='oBcis'><b id='oBcis'><form id='oBcis'><ins id='oBcis'></ins><ul id='oBcis'></ul><sub id='oBcis'></sub></form><legend id='oBcis'></legend><bdo id='oBcis'><pre id='oBcis'><center id='oBcis'></center></pre></bdo></b><th id='oBcis'></th></span></q></dt></tr></i><div id='oBcis'><tfoot id='oBcis'></tfoot><dl id='oBcis'><fieldset id='oBcis'></fieldset></dl></div>
                  <bdo id='oBcis'></bdo><ul id='oBcis'></ul>
                  本文介绍了插入日期的php/Mysql查询失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经搜索了很长时间,但我不明白为什么我的查询不适用于日期.

                  I have been searching for quite a while now and I can't figure out why my query isn't working for dates.

                  我希望将它作为日期导入到我的数据库中,这是从更高层的选择,所以我在这里.

                  I want it to be imported to my database as a Date, this is a choice from higher up so here I am.

                  $insert_query = "INSERT INTO enrties(
                  `datum` )
                  VALUES (
                  '".mysql_real_escape_string($_SESSION['Datum'])."')
                  

                  上面几页之前我用这段代码来填充$_SESSION

                  a few pages before the above i use this piece of code to fill the $_SESSION

                  $DateDag = $_POST['Dag'];
                  $DateMaand = $_POST['Maand'];
                  $DateJaar = $_POST['Jaar'];
                  switch ($dateMaand)
                  {
                  case 'Januari': $DateMaand = '01'; break;
                  case 'Februari': $DateMaand = '02'; break;
                  case 'Maart': $DateMaand = '03'; break; 
                  case 'April': $DateMaand = '04'; break; 
                  case 'Mei': $DateMaand = '05'; break;   
                  case 'Juni': $DateMaand = '06'; break;  
                  case 'July': $DateMaand = '07'; break;  
                  case 'Augustus': $DateMaand = '08'; break;  
                  case 'September': $DateMaand = '09'; break; 
                  case 'Oktober': $DateMaand = '10'; break;   
                  case 'November': $DateMaand = '11'; break;  
                  case 'December': $DateMaand = '12'; break;      
                  }
                  $_SESSION['Datum'] = $DateDag. '-'. $DateMaand. '-'. $DateJaar;
                  

                  我想将日期导入为 SQL 日期格式(最好是 DD-MM-YYYY 格式).

                  I want to have the date imported as a SQL Date format (preferably DD-MM-YYYY format).

                  解决了,开关中出现了一个错误显然,不确定是什么,但它有效;)

                  SOLVED, there was a mistake in the switch Apparantly, not really sure what but it works ;)

                  推荐答案

                  MySQL 的日期格式实际上是 YYYY-MM-DD,所以如果你想插入一个日期(猜测你的数据字段是 Date 或 Datetime)你必须以这种方式设置您的字符串.

                  The MySQL date format is actually YYYY-MM-DD, so if you want to insert a date (guessing your datum field is Date or Datetime) you have to set up your string in that way.

                  如果你想以不同的方式插入你的日期,你应该使用这个:

                  If you want to insert your date in a different way you should use this:

                  INSERT INTO enrties (datum) VALUES (str_to_date('01/02/2000', '%d/%m/%Y')); 
                  

                  但这将始终以 YYYY-MM-DD 方式保存日期,因为这是 mysql 的默认设置.

                  but this will save always the date in YYYY-MM-DD way, since is the default for mysql.

                  这篇关于插入日期的php/Mysql查询失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <bdo id='nhZWr'></bdo><ul id='nhZWr'></ul>
                  • <legend id='nhZWr'><style id='nhZWr'><dir id='nhZWr'><q id='nhZWr'></q></dir></style></legend>
                      <tbody id='nhZWr'></tbody>

                          <i id='nhZWr'><tr id='nhZWr'><dt id='nhZWr'><q id='nhZWr'><span id='nhZWr'><b id='nhZWr'><form id='nhZWr'><ins id='nhZWr'></ins><ul id='nhZWr'></ul><sub id='nhZWr'></sub></form><legend id='nhZWr'></legend><bdo id='nhZWr'><pre id='nhZWr'><center id='nhZWr'></center></pre></bdo></b><th id='nhZWr'></th></span></q></dt></tr></i><div id='nhZWr'><tfoot id='nhZWr'></tfoot><dl id='nhZWr'><fieldset id='nhZWr'></fieldset></dl></div>
                          <tfoot id='nhZWr'></tfoot>

                          • <small id='nhZWr'></small><noframes id='nhZWr'>