Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

PHP help please

Status
Not open for further replies.
Is the format of the date field in the DB table DATETIME instead of DATE?

DATETIME = YYYY-MM-DD HH:MM:SS
DATE = YYYY-MM-DD

Because CURDATE() returns the date in the format YYYY-MM-DD, which means if the date field was DATETIME then it would not match (the hours, mins, secs throwing it off) .

If so, you can use DATE_FORMAT to change the value extracted from the DATETIME field. For example:

PHP:
SELECT * FROM table WHERE DATE_FORMAT( datetime_field, '%Y-%m-%d' ) = DATE_SUB( CURDATE(), INTERVAL 2 DAY )
 
In that case could try:

HTML:
SELECT * FROM table WHERE FROM_UNIXTIME( fieldname, '%Y-%m-%d' ) > date_SUB( CURDATE(), INTERVAL 2 DAY )
 
SELECT fieldname, FROM_UNIXTIME( fieldname, '%Y-%m-%d' ), CURDATE(), DATE_SUB( CURDATE(), INTERVAL 2 DAY )
FROM table
LIMIT 5

Paste in the results of the above query here - might make it easier to spot something...
 
admin sorted code anyway. =)
 
Last edited:
hi admin,

you probably already know, but i think maybe,

IF bidcount row >= 1 {

show }

else {
"be the first to bid" (whatever)
}

i could give a better answer if i could see the code, table/feild names.

pm me if you want me to have a "proper bash" tomo.
 
hi admin,

you probably already know, but i think maybe,

IF bidcount row >= 1 {

show }

else {
"be the first to bid" (whatever)
}

i could give a better answer if i could see the code, table/feild names.

pm me if you want me to have a "proper bash" tomo.
I'm already using the IF and ELSE to alternate the row colours. How do I do both?
 
Hi admin,

Im dont know the names of your rows or excatly how you've done the if/elses for the row colours, but maybe something like this,



your IF (condition for row colour) {

your if code for row colour;

/* new if stament */ IF (yourbidcount.row >= 1) {

print ("<a href=\"linkToBidPage/\">view bids</a> ");

}



else {

print("be the first to bid");

}

}

your else {

your else code for the row colour

/* new if stament */ IF (yourbidcount.row >= 1) {

print ("<a href=\"linkToBidPage/\">view bids</a> ");

}



else {

print("be the first to bid");

}

}


}


Its a bit messy, but should work.
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Featured Services

Sedo - it.com Premiums

Sponsors

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel

Sponsors

Acorn Domains Merch
MariaBuy Marketplace

Shiny Nuts

Perfect
Service
Laskos
URL Shortener
*the exceptional businesses of our esteemed moderators
Top Bottom