Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › MYSQL: Adding Rows help Auto Increment
New Posts  All Forums:Forum Nav:

MYSQL: Adding Rows help Auto Increment

post #1 of 4
Thread Starter 
I am trying to add years from 1900 all the way to 2000 and I don't want to do all 100 one by one.

The code to add one row is this:

INSERT INTO `maximus2_proauto`.`setup_rangeyear` (
`rangeyear_id` ,
`rangeyear_name_1` ,
`rangeyear_name_2` ,
`rangeyear_name_3` ,
`rangeyear_name_4` ,
`rangeyear_name_5` ,
`rangeyear_name_6` ,
`rangeyear_name_7` ,
`rangeyear_name_8` ,
`rangeyear_name_9` ,
`rangeyear_name_10` ,
`rangeyear_value`
)
VALUES (
'51', '1951', '1951', '', '', '', '', '', '', '', '', '1951'
);



That is the year 1951 for example. How could I write the mysql to say add the each row from 1900 -2000 and each time auto increment all the way to 2000. So for the next year, 1952, it would be the exact same, but 1951 will change to 1952 and the 51 will change to 52?

I know that there is a way and I've tried googling , but just can't find it.

Hope someone can help!

Thanks smile.gif
Ahh!
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 D0 4.11 GHz Asus P6T Sapphire HD 5770 1GB Corsair DDR3 1600 6GB 
Hard DriveOSMonitorPower
C300 128GB | WD Green 1TB Win 7 Ulimate 64-Bit Samsung 2770H Corsair 650HX 
Case
CM Sniper Black Edition 
  hide details  
Reply
Ahh!
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 D0 4.11 GHz Asus P6T Sapphire HD 5770 1GB Corsair DDR3 1600 6GB 
Hard DriveOSMonitorPower
C300 128GB | WD Green 1TB Win 7 Ulimate 64-Bit Samsung 2770H Corsair 650HX 
Case
CM Sniper Black Edition 
  hide details  
Reply
post #2 of 4
Do you have access to PHP? I would write a quick little php script that would do it. Just a quick while loop and increment would get it done pretty quickly.
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA GTX 780 SC ACX Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 (Stock cooler on while RMA :( ) Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA GTX 780 SC ACX Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 (Stock cooler on while RMA :( ) Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
post #3 of 4
Thread Starter 
How does that work? I'm doing this in phpmyadmin.
Ahh!
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 D0 4.11 GHz Asus P6T Sapphire HD 5770 1GB Corsair DDR3 1600 6GB 
Hard DriveOSMonitorPower
C300 128GB | WD Green 1TB Win 7 Ulimate 64-Bit Samsung 2770H Corsair 650HX 
Case
CM Sniper Black Edition 
  hide details  
Reply
Ahh!
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 D0 4.11 GHz Asus P6T Sapphire HD 5770 1GB Corsair DDR3 1600 6GB 
Hard DriveOSMonitorPower
C300 128GB | WD Green 1TB Win 7 Ulimate 64-Bit Samsung 2770H Corsair 650HX 
Case
CM Sniper Black Edition 
  hide details  
Reply
post #4 of 4
Quote:
Originally Posted by maximus20895 View Post

How does that work? I'm doing this in phpmyadmin.

I take it your running a WAMP stack?
Main Rig.
(14 items)
 
Battlefield 2 review.
Battlefield 2 PC Game EA
 
CPUMotherboardGraphicsRAM
Bulldozer FX4100 Gigabyte GA-M68MT-S2 MSI 7770 Kingston Hyper X | 2 x 2 GB 
Hard DriveOptical DriveCoolingOS
WD 2 TB  LiteON DVD/CD R-W Drive AMD Standard cooler Windows 7 Ultimate 
MonitorKeyboardPowerCase
32' Luxor Full HD TV Microsoft comfort curce Antec 450 Watt OcUK Value case 
MouseAudio
Microsoft wireless mouse Logitech speakers & Bass 
  hide details  
Reply
Main Rig.
(14 items)
 
Battlefield 2 review.
Battlefield 2 PC Game EA
 
CPUMotherboardGraphicsRAM
Bulldozer FX4100 Gigabyte GA-M68MT-S2 MSI 7770 Kingston Hyper X | 2 x 2 GB 
Hard DriveOptical DriveCoolingOS
WD 2 TB  LiteON DVD/CD R-W Drive AMD Standard cooler Windows 7 Ultimate 
MonitorKeyboardPowerCase
32' Luxor Full HD TV Microsoft comfort curce Antec 450 Watt OcUK Value case 
MouseAudio
Microsoft wireless mouse Logitech speakers & Bass 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › MYSQL: Adding Rows help Auto Increment