|
|
|
| в командной строкe mysql пишу:
select * from carimages where cmark='iz' and cmodel='2717'
output:
id ,cmark,, cmodel, images
309 iz 2717 2717_1.JPG
310 iz 2717 2717_2.JPG
311 iz 2717 2717_3.JPG
312 iz 2717 2717_4.JPG
все ОК
теперь получить то же самое с помощью php:
$ok_2="select * from carimages where cmark='iz' and cmodel='2717'";
$h2= mysql_query($ok_2);
$countimages = mysql_num_rows($h2);
for($t=0; $t<=$countimages; $t++){
$h4= mysql_query($ok_2);
$h3=mysql_fetch_array($h4);
echo $h3["images"];
}
// mne nado 4tobq vqvel vse nazvanija images 2717_1.JPG, 2717_2.JPG, 2717_3.JPG, 2717_4.JPG
// a on vqvodit tri raza 2717_1.JPG :)) v 4em delo?
|
Thank you for your answers =) | |
|
|
|
|
|
|
|
для: katok
(05.05.2009 в 04:09)
| | это потому что Вы зачем-то в цикле делаете 4 раза mysql_query()
Вы же в консоли 4 раза один и тот же запрос не набираете? | |
|
|
|
|
|
|
|
для: Trianon
(05.05.2009 в 08:15)
| |
$ok_2="select * from carimages where cmark='".$mymark."' and cmodel='".$mymodel."'";
$h2= mysql_query($ok_2);
$countimages = mysql_num_rows($h2);
for($t=0; $t<$countimages; $t++){
if($t != $countimages){
$zap = ";";
}
else{
$zap = "";
}
$ok_3 .= "select * from carimages where cmark='".$mymark."' and cmodel='".$mymodel."'$zap";
echo $h3['images'];
} // end FOR
$h4= mysql_query($ok_3);
$h3=mysql_fetch_array($h4);
|
// 4to opjat ne tak delaju)? | |
|
|
|
|
|
|
|
для: katok
(05.05.2009 в 14:13)
| |
$ok_2="select * from carimages where cmark='iz' and cmodel='2717'";
$h4= mysql_query($ok_2);
$countimages = mysql_num_rows($h2);
for($t=0; $t<=$countimages; $t++){
$h3=mysql_fetch_array($h4);
echo $h3["images"];
}
|
а еще проще - так:
$ok_2="select * from carimages where cmark='iz' and cmodel='2717'";
$h4= mysql_query($ok_2);
while($h3=mysql_fetch_array($h4))
{
echo $h3["images"];
}
|
| |
|
|
|
|
|
|
|
для: Trianon
(05.05.2009 в 14:35)
| | Spasibo bolshoe! | |
|
|
|