Cooper94 Posted December 3, 2009 Share Posted December 3, 2009 $result = mysql_query("SELECT * FROM flights"); while ($row = mysql_fetch_array($result)) { if ($flight_num == $row['flight_num']){ echo "<center>Flight Number Used!</center>"; }else{ $sql=mysql_query("INSERT INTO flights (`flight_num`, `dep_icao`, `dep_time`, `dep_name`, `arr_icao`, `arr_time`, `arr_name`, `route`, `aircraft`, `days`, `duration`, `status`) VALUES ('$flight_num','$dep','$dep_time','$dep_name','$arr','$arr_time','$arr_name','$route','$aircraft','$days','$duration','$status')"); header ('Location: ?page=flt_ctr'); }} When I run this code it puts several rows of the same information. Say I press submit it will output more than 1 row in the database. Any help would be great, thank you for your time. Quote Link to comment https://forums.phpfreaks.com/topic/183809-entering-data-problem/ Share on other sites More sharing options...
premiso Posted December 3, 2009 Share Posted December 3, 2009 Well for starters that can be done in a more efficient matter. Where does $flight_num come from and what is the mock up of it (post some example flight nums). And I can help you make this more efficient for ya. Quote Link to comment https://forums.phpfreaks.com/topic/183809-entering-data-problem/#findComment-970229 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.