I have a table of people that is populated with all the MLB players (mostly contiguous by team), coaches and refs, as follows:
+-----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| firstname | varchar(30) | NO | | NULL | |
| lastname | varchar(30) | NO | | NULL | |
+-----------+-------------+------+-----+---------+----------------+
as well as a players table, which is empty, but described as follows:
+-----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| person_id | int(11) | NO | MUL | NULL | |
| team_id | int(11) | NO | MUL | NULL | |
+-----------+---------+------+-----+---------+----------------+
And I want to be able to loop through the players table and add in a range of person_ids and team_ids like this:
for(int x=100; x < 140; x++)
insert into player values (NULL, x, 6)
but I know I can't mix and match languages like that, so how can I accomplish this? And if you need any further information just ask.