Added DATE_FORMAT to my query bombs he... I want to know why

Hi all

Well, I write a VERY simple page that shows the user a lidt of recent updates to data in a database defined timed for release.

This query works absolutely perfect:

$conn = dbConnect ('query');
$sql = "SELECT."
ANNEX
WHERE start_date arguments < = CURDATE)
AND end_date > CURDATE)
ORDER BY store_number ASC";
$result = $conn-> Query or die (mysqli_error ());
$upDates = $result-> fetch_assoc();

BUT...

.. When I add a DATE_FORMAT command such as shown below...

$conn = dbConnect ('query');
$sql = "SELECT."
ANNEX
WHERE start_date arguments < = CURDATE)
AND end_date > CURDATE)
ORDER BY store_number CSA
Date_format(start_date, '%M/%e/%D/%Y') AS start_date";
$result = $conn-> Query or die (mysqli_error ());
$upDates = $result-> fetch_assoc();

.. .He bombs.

This query selects all the data of a table of 4 columns and displays the data perfectly in the first example, as I mentioned. I don't like the date format, and I wanted to change, so the addition of the DATE_FORMAT in the second example. Start_date is one of the columns in my table called "Annex".

Please tell me why it is bombing. I don't have a clue and have analyzed and tested again the code without success.

Thank you very much in advance for your help!

Sincerely,

wordman

The SQL is not valid. You can just add a select column at the end of a SQL query. You must respect the basic rules of the SQL structure. Select columns must appear before the FROM clause.

$conn = dbConnect ('query');
$sql = "SELECT *, DATE_FORMAT(start_date, '%M/%e/%D/%Y') AS start_date1.
ANNEX
WHERE start_date arguments<=>
AND end_date > CURDATE)
ORDER BY store_number ASC";
$result = $conn-> query ($sql) or die (mysqli_error ());
$upDates = $result-> fetch_assoc();

I have an alias in start_date to start_date1 to avoid ambiguity.  I don't know MySQL so I take just your function DATE_FORMAT is delivered.

Tags: Dreamweaver

Similar Questions

  • I want a NEW computer, but I want Windows XP on it. I don't like about adding new fangled to it. I just want to use my OLD stuff. Is this possible?

    I want a NEW computer, but I want Windows XP on it.  I don't like about adding new fangled to it.  I just want to use my OLD stuff.  Is this possible?

    Hello

    If you are considering buying new PCs, you can go ahead and buy Windows 7 Professional, Ultimate or enterprise. These editions of Windows 7 supports Windows XP Mode, where you can use all programs Windows XP. You can also use the Windows compatibility mode to run Windows XP programs in Windows 7. For more information, see:

    Buy Windows 7: main questions

    http://Windows.Microsoft.com/en-us/Windows/shop/buying-Windows-7-top-questions

  • Cursor shows as black extended block & wants to know if his friend is added in the administrator settings.

    Original title: Admin account settings.

    A friend just to configure the settings of the administrator on the computer that I use, it also added a Passport Network account on behalf of user xp MyWindowsApp. I just want to know if he added himself. and why is my cursor a black block extended.

    You can check the user accounts to see if your friend has added itself to the account administrator or any other user account.

    To open the tool user accounts, open Control Panel from the Start menu, and then double-click user accounts.
    You can view user accounts and if you see all the accounts you do not know.
    You can choose to delete the user account. Make sure that you do not remove the administrator account,
    Guest account or the system account. They are accounts by design.
    Double-click the account and check who's a member of the account.

  • Hi I am new to Oracle forms and reports I want to know the differences between the Enter query mode and Normal mode?

    Hi I am new to Oracle forms and reports I want to know the differences between the Enter query mode and Normal mode?

    Welcome to Oracle Forms!  Out of curiosity, what do you mean by 'new '?  You are a student or new to an organization that uses Oracle Forms?  Or just play with Oracle Forms to learn something new?

    Let me start by saying that many of your questions designtime can answer by searching in the help of the constructor of the form library.  It's accessible, like most of the other products in the Builder menu > help.

    Regarding your question, ENTER QUERY mode, as the term implies, is when it is in a State where it is accept input for the execution of a query.  When in this mode, there are various restrictions.  Yet once, it will find more details in the Builder Help.  In this case, search help for these two subjects, "SYSTEM." MODE'and "built-ins comments that are not allowed in the input query Mode".  There are many other pages that contain information about the ENTER_QUERY method, but these two should help you get started.

    Normal mode, as its name implies, is when it is in a State of 'normal '.  Basically to do nothing in particular, but also not in ENTER QUERY mode.  In this State, you can move the shape, INSERT, UPDATE, DELETE, documents, etc..

    You will find additional information, as well as a lot of documentation on the product page of forms of OTN:

    http://www.Oracle.com/technetwork/developer-tools/forms

  • I added a few. WAV files and you want to add the artist names and album

    I added a few. Recording WAV files form a USB turntable.  How can I add the name of the artist and album in iTunes before you convert them into MP3 files to load on a player MP #?

    For all types of files you can call by clicking on the location of the name / artist, when it is selected. It should be more when you convert the.

  • I want to know how to achieve the effect of adding the numbers as in the lower given the video using legacy.

    Video link: understanding quadrilaterals 04 - Types of quadrilaterals - YouTube

    I mean how could it exactly pin point the exact location of the figures, it uses all the other faces inter? or is it just the video was recorded and the figures were added later depending on his hand movements?

    Even if they added figures after having recorded the empty, how it could maintain consistency by pointing the previous figure that there? Is there a technique?

    AE BASICS: You can do simply stationed in drawing on the video layer paths and adding and animating effects > Generate > STROKE or by adding a shape layer, a coup and using ways of toppings. It's just a simple matter of things and in layers.

    If you have more complex paths that you want to follow, you may need to do some follow-up but followed was not necessary at all in this example.

  • New added HDD to load windows xp pro, but can't get on the Internet do not know why.

    Hello, I have a given pc with windows xp prof, he had a small hard drive and I got a bad virus, at that time, I installed a new hard drive and triedto load my Windows XP pro which has refurbished laptop, it loads windows but I can't on the internet!  I have att uverse with a router.  my family has two other calculates online, but he said he always found a link. What I am doing wrong?  Thank you

    Hello

    Maybe this can help.

    For the connection of the wires, http://www.ezlan.net/debug.html

    Wireless, http://www.ezlan.net/wireless.html

  • SQL query: I want to know how to filter data...

    I want to filter these data

    yearDATA_TYPEproduct_nameamount
    20131Apple100
    20131Mango200
    20141Apple300
    20141Mango150
    20141banana250
    20151Apple350
    20152Apple300
    20153Apple320
    20152Mango400
    20153Mango400
    20153banana500

    In each year and each product, I want to filter the data that has no data in data type 1

    When he has not given in data of type 1, using data in data type 2.

    and if he has not given data type 2, use the data in data of type 3.

    This is the result I was expecting

    yearDATA_TYPEproduct_nameamount
    20152Mango400
    20153banana500

    Thanks for your help.

    Or more simply...

    SQL > ed
    A written file afiedt.buf

    1 with t (year, data_type, product_name, amount) as)
    2 Select 2013, 1, 'apple', 100 double Union all
    3 select 2013, 1, "mango", 200 double Union all


    4 Select 2014, 1, 'apple', 300 double Union all
    5 Select 2014, 1, "mango", 150 double Union all
    6 select 2014, 1, 'banana', 250 double Union all
    7 if he would choose 2015, 1, 'apple', 350 dual Union all
    8 select 2015, 2, 'apple', 300 double Union all
    9 select 2015, 3, 'apple', 320 double Union all
    10. Select 2015, 2, "mango", 400 double Union all
    11. Select 2015, 3, "mango", 400 double Union all
    12. Select 2015, 3, 'banana', 500 double
    13        )
    14-
    15 end of test data
    16-
    17 select year
    18, max (data_type) keep (first order by data_type dense_rank) as data_type
    19, product_name
    20, max (amount) to keep (first order by data_type dense_rank) as the amount
    21 t
    Group 22 by product_name, year
    23 * have max (data_type) Dungeon (first order by data_type dense_rank)! = 1
    SQL > /.

    YEAR AMOUNT DATA_TYPE PRODUCTION
    ---------- ---------- ------ ----------
    2015 mango 2 400
    2015 banana 3 500

    2 selected lines.

  • Someone knows why "adding / filter links ' are gray when I try to link a menu item?

    I tried manual menu mode, I went to pages that I want to reassign and set the options of the menu 'include the page without hyperlink '.

    while I could try the reallocation manually... cannot bind to do anything unless I go to a complete dynamic menu... problem is, I want that these menu items.

    but want to use anchor links and wink-scroll on one page in a part of my site... If I highlight ordinary text, no problem. If I connect a graph,

    No problem. Menu is a go though...

    Hello

    Just to confirm, are you facing problems linking your menu manual?

    If so, make sure that you have the selected menu item, not the text in there.

    If it's something else that you are having a problem with, well want to share a screen shot, it would help to understand the problem.

    Concerning

    Sonam

  • Column alias error in one query views

    Hello
    I was trying to drive this query

    Create view dept_sal as
    Select d.department_name, sum (e.salary)
    departments d left outer join employee e
    on e.department_id = d.department_id
    D.department_name group;

    and I received this error message...


    Error in the command line: 2 column: 25
    Error report:
    SQL error: ORA-00998: must appoint this expression with a column alias
    00998 00000 - 'must appoint this expression with a column alias.
    * Cause:
    * Action:


    I tried to put an alias to the function sum (e.salary) and it worked, but I do not understand why it is necessary or is the problem somewhere else and why an alias is needed here?

    In fact the book has not specified the need for an alias to this place... .so I wanted to know why I get this error...

    create or replace view dept_sal as
    Select d.department_name, sum (e.salary) as d_sal
    departments d left outer join employee e
    on e.department_id = d.department_id
    D.department_name group;


    view DEPT_SAL created.



    I also wanted to know if I can start a thread whenever I want to have a problem or if I can add my questions to someone
    otherwise a wire...

    Thank you
    Jayshree

    Also, I wanted to know if I can start a thread everytime I want to have a problem or I can add my questions to someone in another thread...

    Best thing you can do is to start a new thread.
    This is after you have completed :
    -Documentation
    -forums
    and found nothing.
    Do not start new threads that are FAQ...

    Adding questions to existing threads is called 'diversion' a thread and is not appreciated. Especially when you're digging up old threads.

  • Shutdown of blackBerry Smartphones adding + when a call from address book

    Hi, I have an 8830 from Verizon, and I am currently in China. I use a local prepaid card of SIM of China mobile and it works fine. China mobile phone numbers start with 13XXXXXXXXX. I recorded a number in the address book (for example 13888888888, without country code), but when I open the contact and select the call number 13888888888, one more is added when he calls the number that looks like this + 13888888888... of course, this way the phone makes a call to the United States, which is not what I do. To work around this problem, I need to save the number as 8613888888888, so that when the sign is added, he finds the appropriate country code and the Chinese dial without problem, or save the number as + 8613888888888.

    But I don't want to fix all change all the numbers, and I want to know why it is adding the most? Y at - it an option to disable this feature?

    For info, if I [i] call [/ i] the number manually as 13888888888 instead of calling it the address book, it does not add the most...

    Hi saab_rider and welcome to the BlackBerry Forums

    Try this please, go to the phone (by pressing the green button), menu, options, secruit call, change of an unknown country code, try again and let me know please, thanks.

  • Oracle error: How do you change forms Datablock data type of query?

    Hey Experts.

    I am a newbie in Oracle Forms.

    I have a problem regarding the block of data in database.

    I need to change the data by NO block due to the overflow of information in our database.

    Question is how/where can I start to change/modify the codes?


    Thanks in advance!

    Bellerose

    Baski101 wrote:

    ...

    I deleted the relationship between the blocks and the module is now running. I want to ask you the questions and following...

    1. What does the relationship your datablock/s? It runs now, but I want to know why.

    2 How/where you start updating of the DEFAULT_WHERE clause? I mean, I have to create another program unit and ignore the 'old'? Change the units of the old program? Where and what I remove/add?

    ...

    Question 1: A relationship only applies to "Base table data blocks."  Relationships allow synchronizations between master and detail of data blocks.  Basically, this means that when you select a record in the block Master, the retail block will automatically display folders related to the selected record of the master.  In earlier versions of Oracle Forms, the developer had to manually perform this synchronization.

    Question 2: Connection to block non-database - you do not use the DEFAULT_WHERE property.  For blocks of the Base Table, it depends on your needs.  For example, if your form has a search function and shows you a canvas "before" that allows the user to enter criteria for the search, and the user then had to click a button to perform the search, you would put your code in triggering When button button.  If your username is simply the form view application [for example: Forms 6i and earlier - F7 (enter query) or F8 (run the query) and Forms 9i or higher - F11 (enter query) or Ctrl + F11 (run the query)] then there is no need to change the DEFAULT_WHERE because the forms accomplishes this task for you.  Another example would be - if you have a block of the base table, but the user has the ability to use the elements in array to another basic search - you can use the motion of a block of the base table to change the selected property DEFAULT_WHERE to use the elements of the other base table to filter your data.

    I hope this helps.

    Craig...

  • When I saw my site to load there is extra space added on the left hand side

    When I saw my site and load until there is an extra space is added on the left hand side and I don't know why or hot to fix it. I have attached two picture to show what I mean. Any help would be great.

    My workspace

    Screen Shot 2016-01-18 at 8.49.39 PM.png

    My overview

    Screen Shot 2016-01-18 at 8.49.58 PM.png

    This may be because of the frame of image outside the area of the page, any other content outside page page, any empty container etc.

    Thank you

    Sanjit

  • Complex query - sort, join

    Hello

    I have and control panels and Department.

    I'm trying to get a set of records as such:
    * get 50 entries of orders with the lowest time_of_order time table, time of order is not null and department_id = 1
    * Get 40 records of control panel with the lowest time of time_of_order, at the time of the order is not null and department_id = 2
    * get 30 records in the order with time table lowest of time_of_order, at the time of the order is not null and department_id = 3
    ...
    * get 10 records in the table control with the lowest time_of_order time, time of order is not null and department_id = 5


    I came up with something like this:

    SELECT items.order_id,
    Items.Order_Details,
    Items.department_name
    Items.time_of_order
    FROM (SELECT Row_number()
    During)
    ORDER BY time_of_order ASC) AS ROW_NUMBER,
    NS.order_id,
    NS. Order_Details,
    NS.department_name
    NS.time_of_order
    Ns orders
    outer join left Department dept
    ON ns.department_name = dept.department_name
    WHERE dept.department_id = 1
    AND ns.time_of_order IS NOT NULL
    WHERE row_number < = 50
    UNION ALL
    ...
    UNION ALL
    SELECT items.order_id,
    Items.Order_Details,
    Items.department_name
    Items.time_of_order
    FROM (SELECT Row_number()
    During)
    ORDER BY time_of_order ASC) AS ROW_NUMBER,
    NS.order_id,
    NS. Order_Details,
    NS.department_name
    NS.time_of_order
    Ns orders
    outer join left Department dept
    ON ns.department_name = dept.department_name
    WHERE dept.department_id = 5
    AND ns.time_of_order IS NOT NULL
    WHERE row_number < = 10



    This statement is very long and effective questionable (my query would go again and again looped while the data changes dynamically. There is large amount of data).

    How can I rewrite it without all these statements of UNION? Do you see how to improve the effectiveness of the statement? I'd appreciate any help.

    Hello

    IF you "PARTITION BY department_id", you get results like a UNION, where each branch of the UNION made only department_id.

    Here's one way:

    WITH  got_r_num      AS
    (
         SELECT  ns.order_id
         ,     ns.order_details
         ,     ns.department_name
         ,     ns.time_of_order
         ,     dept.department_id
         ,     ROW_NUMBER () OVER ( PARTITION BY  dept.department_id
                                   ORDER BY          ns.time_of_order
                           )          AS r_num
         FROM           orders          ns
         LEFT OUTER JOIN      department     dept  ON   ns.department_name  = dept.department_name
         WHERE   dept.department_id     IN (1, 2, 3, 4, 5)
         AND     ns.time_of_order     IS NOT NULL
    )
    SELECT       *     -- or list all columns except department_id and r_num
    FROM       got_r_num
    WHERE       r_num          <= 10 * (6 - department_id)
    ORDER BY  department_id
    ,            r_num
    ;
    

    If you would care to post some sample data (CREATE TABLE and INSERT statements) and the results desired from these data, then I could test it.
    Feel free to simplify the problem. For example "I want the.
    6 first rows of department_id = 1, the
    4 first department_id = 2 rows and the
    first 2 rows department_id = 3. »

    If you're concerned about efficiency, don't do it in a loop. Do all the values (which otherwise, you would change in the loop) at once, in a single query. If you want to know, post some sample data and the results desired from these data.

  • column added to the table

    Hi all

    I want to know if I can find using oracle built in table when a table has changed. for example,.
    someone has added a column to a table and I want to know when this column has been added (date, time).
    is this possible? in the affirmative, please let me know if you have a request for such a thing

    It is not possible unless you AUDIT the ALTER TABLE.
    LAST_DDL_TIME only records of the table has been changed, not what's happened.

    -----------
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • My iphone6s screen is cracked and unusable. Can I still save my phone?

    My iphone 6s is cracked and unusable, the screen has coloured lines all over. Can I still save my phone? (photos, contacts, ect.)

  • % Of battery

    Hello. I have a 6 over 16 GB iPhone. Anyway, I realized that if I put the iPhone into office (e.g. 50%) and let him sleep for awhile to load ' time, the % of battery rose to 90% FOR EXAMPLE, so everything is normal. But if later I unplug the charger

  • Drive external HARD of PX1399E undetected

    When I plug in my external hard drive of PX1399E in the PC of the blue light turns on for like half a second and then the red light and it is not detected by my pc either... I tried another pc and a different usb cable, but it did not work... I have

  • Windows install and WUDRIVER modules. DLL

    My installer of Modules of Windows does not work so I tried to re - register the windows update dlls.I did high cmd: net stop WuAuServThe Windows Update service stopThe Windows Update service stopped REGSVR32 WUAPI. DLLREGSVR32 WUAUENG. DLLREGSVR32 W

  • UPDATES FAIL WITH 646__ ERROR CODE

    I TRIED TO DOWNLOAD THE FOLLOWING UPDATES, BUT THEY ALL FAIL WITH THE ERROR 646 CODE Update for Microsoft Office Word 2007 (KB974561)Update of security for Microsoft Office 2007 System (KB973704)Update of security for Microsoft Office Excel 2007 (KB9