Jump to content
Fórum Script Brasil
  • 0

Contas A Pagar Daqui X Dias


Guest Rusty
 Share

Question

estou montando um script que mostra as contas vencendo do dia e da semana

na minha database existe a coluna dia

gostaria de saber como posso fazer pra pegar as contas dos proximos 6 dias

$query = sqlquery('SELECT * FROM `contas` WHERE `dia` = dia and `mes` = mes and `ano` = ano ');

pensei em algum laço de repetiçao do tipo

para i = dia to dia +6

i = dia

i = dia + 1

mais ou menos assim

ai logico que teria que checar o mes e ver se tem 30 ou 31 dias

mas acho que existe algum jeito mais facil

alguém poderia ajudar

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Duas opções...

'SELECT * FROM `contas` WHERE `dia` (BETWEEN dia1 AND dia2) and `mes` = mes and `ano` = ano

Ou...

'SELECT * FROM `contas` WHERE (`dia` >= dia1 AND `dia` <= dia2) and `mes` = mes and `ano` = ano

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.5k
×
×
  • Create New...