php - Add multiple values to table mysql -


i creating mysql database , storing stats game. right setting , need add 80 players column each 1 has there goals, assists, etc...

here code:

insert `finalproject`.`bremners` (    `stud_id`,     `stud_name`,     `stud_goal`,     `stud_assist`,    `stud_attendance`,     `stud_goalie` ) values (    '1',     'test',     '0',     '0',     '0',     '0' ); 

but inserts 1 player named "test". know how modify code adds 80 players each 1 different name? (i making website php if can done through php works to)

thanks

well, can start off creating php array of players, loop through array , use mysql add each of players database.

$players = array("john", "jack", "josh"..."80th player");

foreach($players $player): $player = mysql_real_escape_string($player); mysql_query("insert `finalproject`.`bremners` (`stud_id`, `stud_name`, `stud_goal`, `stud_assist`, `stud_attendance`, `stud_goalie`) values ('1', $player, '0', '0', '0', '0')") endforeach; 

i wouldn't use mysql_.. insert database give idea used it.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -