Jump to content
php.lv forumi

IF lietošana kverijā


Alnis

Recommended Posts

Ta, taa kaa nevaru pats izveidot savu topiku ieks "PHP un datubazes" jo saka, ka man nav tadu tiesibu, tad savu jautajumu rakstisu seit.

SELECT lauks1, lauks2, lauks3 FROM tabula

Pienemsim, ka tabula izvada smukas vairakas rindas. Ka lai izdara taa, ka piemeram, ja lauks2=1, tad gribu, lai lauks2 tiktu izvadits kaut kas konkrets, piemeream '3', nevis dati no datubazes. ka tas ir izdarams.?

 

Skatijos mysql funkciju IF, visadi izmeginajos, bet man nesanaca :(

 

man so risinajumu vajag tiesi jau datubaze, ar php no izvaditiem datiem es to maku panakt:)

Paldies par atbildem :)

Link to comment
Share on other sites

Tāpēc, ka topikus nevajag taisīt Arhīva sadaļā. Tos jātaisa normālās sadaļās.

 

Bet par tēmu -

SELECT lauks1, IF(lauks2 = 1, 3, lauks2) FROM tabula

 

1. nepamaniju, ka netisam iemaldijos arhova sadala :)

2. Paldies, viss strada perfekti, izradijas pavisam vienkarsi.

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
Reply to this topic...

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

Loading...
×
×
  • Create New...