Hey all,
I have an auto number and with testing etc it is no longer set at 0. So when i make the thing live/hand it over to client, i would like the auto number to be back at 0....
Any ideas how to reset it?
Thanks
thanks people thought i had already said i had sorted it
in the end the code did work but because i was running two quires in a while the $sql and $result etc were getting mixed up each time :S
<?php
$qDate2 = functionQuery("SELECT DATE_FORMAT('$offerEndDate', '%W %D %M %Y') FROM...
thats correct!
function functionQuery($sql){
// Database connection
include ("include/dbConnection.php");
// Query databse with sql that is passed to function
$q = mysql_query($sql, $link) or die(mysql_error());
// Reture result
return $q;
}
Do you ever post anything but the obvious! :p
Definde "dont work". MySQL's date_format() function will work with columns of type DATE.
I just need to find out how to get offerEndDate (DATE) (YYYY-MM-DD) outputted like Friday 2nd July 2004.
When i do this
$q =...
ok although i have that one sorted now can you explain why...
When i use TIMESTAMP you get YYYYMMDD
but when you use DATE it uses YYYY-MM-DD
I can get dateAdded in nice format (Friday 2nd July 2004) using:
SELECT DATE_FORMAT(dateAdded, '%W %M %Y') FROM offers
But when i try that on...
got it
$q = functionQuery("SELECT DATE_FORMAT(dateAdded, '%W %M %Y') FROM offers");
$result = mysql_fetch_row($q);
$dateAddedFormatted = $result[0];
print "$dateAddedFormatted";
nice one thanks
still need to get my head around it a bit more but i am getting...
ok well i am still none the wiser now.....
dateAdded is TIMESTAMP(8)
which is YYYYMMDD
thats fine because i can use that to filter stuff and also use it for eventDate to just show future events and not events in the past etc...
but i want to actually display a nice date on the site
somthing...
OK one more question.
eg:
tableEvents right
id | eventDate (DATE) | dateAdded (TIMESTAMP)
ok TIME STAMP adds YYYYMMDD auto
and DATE adds my inputted date formatted like YYYY-MM-DD
Now when i read these from the database i get them like
$eventDate
$dateAdded
Now can I format this date...
OK yer I know what i am saying but i am never very good at getting it across to others.
What you have said in this post has helped me alot.
Thank you for your time.
this is what i am working on
http://www.jgmwebdesign.co.uk/prototypes/cairnsandhickeywines/news_events_offers.php
thats a great help........
one more question...
i will from now on use the TIMESTAMP and also use dates in the format YYYY-MM-DD right, this might sound stupid.... but do i set the field type to DATE in the MySQL database?
and if yes when i get the date and print $dateAdded right will it be...
OK I need to sort this out in my mind once and for all.
When i am displaying the date for some reson on my site i use date(M:Y); yer we all know that one.
OK now i have never got it right when i use dates with databases so i need to learn.
For example.
I have an events table in my database...
thats a good idea
$upper=$lower + 10;
i have decided to just go a with this:
if ($searchPrice == "0") { $lowerbound = "0.00" ; $upperbound = "500.00" ; }
if ($searchPrice == "1") { $lowerbound = "0.00" ; $upperbound = "5.99" ; }
$q = functionQuery("SELECT * FROM items WHERE itemCountry =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.