Jump to content
php.lv forumi

ar while aizstāt foreach


anonīms

Recommended Posts

Patreizējais kods: http://paste.php.lv/148295fc55192d1eb80b88490d52ce67?lang=php

Ir nepieciešams aizstāt foreach ar while, jo vajag izmantot

while($kkas <= 6)

Pagaidām, kad arrayā ir 6 dati, tad viss okey, bet ir nepieciešams vēl nenoteikts skaits, kas nozīmē, ka vajag kodu, kas izvelk tikai 6 kartes. Kā to panākt?

Link to comment
Share on other sites

Pirmkārt, stulbi ir saukt 6 kvērijus no vietas, ja to var izdarīt ar vienu piegājienu.

INSERT INTO table1(col1, col2, col3) VALUES (val1, val2, val3), (val4, val5, val6), ......

 

Otrkārt

 

for($i=0;$i<6;$i++){
echo $arr[$i];
}

Edited by briedis
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...