Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

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...
 
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.

Rule #1: Be Respectful

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

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom