Jump to content

Recommended Posts

create table Charger(
cid int not null auto_increment,
trademark varchar(20) not null,
type varchar(30) not null,
model varchar(30) not null,
unitprice int not null
primary key(cid));

well here is my sql for i want to view the entries which are made accroding to the date and the date format should be either view by date or view by month any ideas wat should i add to this table like which format of date and how to view it either by Group by or some other function?

Link to comment
https://forums.phpfreaks.com/topic/95180-suggestion-needed/
Share on other sites

The table definition you gave does not have a field in which a date would be stored, so there's no hope of sorting anything/selecting anything based on a date criterion.

 

Add a field to your db-table. Set the type to date - that will default to the ISO standard date format of yyyy-mm-dd.  That's good as it allows you to make comparisons far more readily than any other date format.  When you display date information from the database, you can format the displayed date in any manner you want, by using the date() function ...

Link to comment
https://forums.phpfreaks.com/topic/95180-suggestion-needed/#findComment-487725
Share on other sites

SELECT * from db_table ORDER by datex ... datex is the fieldname, isn't it?  That will give you results ordered by date.  If you want sub-sets of that then use a typical WHERE syntax in your query and forget the ORDER, i.e. SELECT * from db_table WHERE datex = 'yourdatehere'

Link to comment
https://forums.phpfreaks.com/topic/95180-suggestion-needed/#findComment-487765
Share on other sites

I would reply to that if I had any idea what you just said.

 

When you are communicating with text as your medium, punctuation is a necessity so as to get your point across in a manner that people can understand. Especially when you are asking their help. Its impossible to help someone when you don't even know what it is they are asking.

Link to comment
https://forums.phpfreaks.com/topic/95180-suggestion-needed/#findComment-487833
Share on other sites

well it is also meaningless to posting a reply to that post which u are unable to understand this is what the way is other then putting a period it is much better to sit a side let the others go for it if they want rather then making the help method useless and always leave a hope for any one who is trying to learn do not tell them to go off the road. :)

Link to comment
https://forums.phpfreaks.com/topic/95180-suggestion-needed/#findComment-487840
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.