taekwondokid42
New Member
- Messages
- 268
- Reaction score
- 0
- Points
- 0
$result1 = mysql_query("SELECT * FROM people WHERE id = '$number[0]'") or die(mysql_error());
$row1 = mysql_fetch_array( $result1 );
$result2 = mysql_query("SELECT * FROM people WHERE id = '$number[1]'") or die(mysql_error());
$row2 = mysql_fetch_array( $result2 );
$result3 = mysql_query("SELECT * FROM people WHERE id = '$number[2]'") or die(mysql_error());
$row3 = mysql_fetch_array( $result3 );
$result4 = mysql_query("SELECT * FROM people WHERE id = '$number[3]'") or die(mysql_error());
$row4= mysql_fetch_array( $result4 );
$result5 = mysql_query("SELECT * FROM people WHERE id = '$number[4]'") or die(mysql_error());
$row5 = mysql_fetch_array( $result5 );
echo $row1[answer];
echo $row2[answer];
echo $row3[answer];
echo $row4[answer];
echo $row5[answer];
Is there anyway I can put this code into a loop?
$row1 = mysql_fetch_array( $result1 );
$result2 = mysql_query("SELECT * FROM people WHERE id = '$number[1]'") or die(mysql_error());
$row2 = mysql_fetch_array( $result2 );
$result3 = mysql_query("SELECT * FROM people WHERE id = '$number[2]'") or die(mysql_error());
$row3 = mysql_fetch_array( $result3 );
$result4 = mysql_query("SELECT * FROM people WHERE id = '$number[3]'") or die(mysql_error());
$row4= mysql_fetch_array( $result4 );
$result5 = mysql_query("SELECT * FROM people WHERE id = '$number[4]'") or die(mysql_error());
$row5 = mysql_fetch_array( $result5 );
echo $row1[answer];
echo $row2[answer];
echo $row3[answer];
echo $row4[answer];
echo $row5[answer];
Is there anyway I can put this code into a loop?
Last edited: