Help ..... arrays

Secţiune dedicată începatorilor.

Moderatori: Moderatori, Start Moderator

ashantyk
PHPRomania Supporter
Mesaje: 22
Membru din: Sâm Ian 19, 2008 10:49 pm
Localitate: Vaslui
Contact:

Help ..... arrays

Mesajde ashantyk » Joi Ian 24, 2008 6:38 pm

if ($cat == 'age'){
$cond1 = date(y) - $cond;
$cond2 = date(y) - $cond - 1;
$array1 = mysql_query("select * from iduri where b_year like \"%$cond1%\" order by id");
$array2 = mysql_query("select * from iduri where b_year like \"%$cond2%\" order by id");

$i = 0;
$j = 0;

while ($row = mysql_fetch_array($array1)) {
$p_age = date(Y) - $row['b_year'];
if (date(m) < $row['b_month']) { $p_age = p_$age - 1; }
if (date(m) == $row['b_month']) {
if (date(d) < $row['b_day']) { $p_age = p_$age - 1; }
if ($p_age == $cond) { array1c[$i] = $row[$row['nrcrt']]; $i=$i+1; }}

while ($row = mysql_fetch_array($array2)) {
$p_age = date(Y) - $row['b_year'];
if (date(m) < $row['b_month']) { $p_age = p_$age - 1; }
if (date(m) == $row['b_month']) {
if (date(d) < $row['b_day']) { $p_age = p_$age - 1; }
if ($p_age == $cond) { array2c[$j] = $row[$row['nrcrt']]; $j=$j+1; }}


$result = array_merge($array1c, $array2c);
}


while ($row = mysql_fetch_array($result)) {
if ($row['validated']=='yes') { echo '<p>' . $row['id'] . ' ' . $row['nick'] . ' ' . $row['age'] . ' ' . $row['*'] . ' ' . $row['city'] . ' ' . $row['state'] . '</p>'; }
}

Ce nu e bun? ca eu nu mi-am dat seama si imi cade parul din cap de nervi :| ... app: 'nrcrt' ala e index, primary, autoincrement



ashantyk
PHPRomania Supporter
Mesaje: 22
Membru din: Sâm Ian 19, 2008 10:49 pm
Localitate: Vaslui
Contact:

Mesajde ashantyk » Joi Ian 24, 2008 7:42 pm

if ($cat == 'age'){
$cond1 = date(Y) - $cond;
$cond2 = date(Y) - $cond - 1;
$cond3 = date(Y) - $cond + 1;

$array1 = mysql_query("select * from iduri where b_year like \"%$cond1%\" order by id");
$array2 = mysql_query("select * from iduri where b_year like \"%$cond2%\" order by id");
$array3 = mysql_query("select * from iduri where b_year like \"%$cond3%\" order by id");

$result = array_merge($array1, $array2, $array3);

}

while ($row = mysql_fetch_array($result)) {
if ($row['validated']=='yes') { echo '<p>' . $row['id'] . ' ' . $row['nick'] . ' ' . $row['age'] . ' ' . $row['*'] . ' ' . $row['city'] . ' ' . $row['state'] . '</p>'; }
}


sau makr asta de ar merge :(

iulyan_25
PHPRomania Supporter
Mesaje: 16
Membru din: Dum Ian 27, 2008 1:49 am

Mesajde iulyan_25 » Dum Ian 27, 2008 2:19 am



Înapoi la “PHP Incepători”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 19 vizitatori