snowman15 Posted June 27, 2008 Share Posted June 27, 2008 I have no clue why this code isnt working. Check it out. <?php include('db.php'); // ASSUME CONNECTION AND VARIABLES WORK $sql = 'SELECT `people` FROM `users` WHERE `user` LIKE CONVERT(_utf8 \''.$_SESSION['user'].'\' USING latin1) COLLATE latin1_swedish_ci'; $result = $db->query($sql); $row = mysqli_fetch_assoc($result); for($i==1; $i<=$row['people'];$i++){ echo'<option>'.$i.'</option>'; } ?> Link to comment https://forums.phpfreaks.com/topic/112224-solved-quick-question-on-for-loop/ Share on other sites More sharing options...
lonewolf217 Posted June 27, 2008 Share Posted June 27, 2008 just a thought, shouldn't it be for($i=1; $i<=$row['people'];$i++){ since you are initially assigning $i equal to 1, you are not trying to do a boolean compare if $i really is 1 Link to comment https://forums.phpfreaks.com/topic/112224-solved-quick-question-on-for-loop/#findComment-576112 Share on other sites More sharing options...
ohdang888 Posted June 27, 2008 Share Posted June 27, 2008 always use this: $result = $db->query($sql) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/112224-solved-quick-question-on-for-loop/#findComment-576115 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.