I’m trying to connect MySQL database and getting out datas
I need it to get only (Data) in order by ID(daily)
and separate both datas and calling them by two different variables
the database looks something like this:
------------------------------
| ID | Data | Data2
------------------------------
| 1 | tea | hot
| 2 | milk | hot
| 3 | pepsi | cold
and output will be only one line (one data)
I don’t make it as above 🙂 it’s just for clarifying….and what’s best collation and type for huge data in UTF-8 ?
Edit:
Can you make it return 5 rows instead of 1? by ID? for e.g. for first day (1-2-3-4-5)ID’s and for second day (6-7-8-9-10) and so on?
And then you select it like:
EDIT!!: I have eliminated datediff, so the ID returned from date difference is DIRECTLY in WHERE.
What this does is calculate difference between first day and current date. So each day that datediff will be 1 bigger.
DATEDIFF(CURDATE()+1, '$firstday') as datediffcan be interpreted asdatediff = 2011-07-07 (there is +1!) - 2011-07-06which is 12011-07-08 - 2011-07-06which is 22011-07-09 - 2011-07-06which is 32011-07-10 - 2011-07-06which is 42011-08-08 - 2011-07-06which is 33so, datediff is each day bigger by 1
Or shortly: Each day will be a different quote, starting with ID 1 forward.
I can’t explain more then this..
EDIT #2: 5 quotes a day
second edit thanks to ajreal (SQL LIMIT syntax error)
EDIT #3: 5 quotes a day, changeable by variable..
option 1:
option 2:
option 3:
So pick one of those options you like, and add it before this: