Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
Thread Tools
  #1  
Old 08-23-2009, 07:57 AM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Question How do I determine the auto increment value

Hi Folks,

I am trying to load a table into MySql by uploading a text file.

Example:

#
# Table structure for table `strokeaverages`
#

CREATE TABLE `strokeaverage` (
`ID` int(5) NOT NULL auto_increment,
`no` varchar(10) NOT NULL default '',
`gender` varchar(1) NOT NULL default '',
`surname` varchar(25) NOT NULL default '',
`name` varchar(25) NOT NULL default ",
`concat` varchar(50) NOT NULL default ",
`2009` varchar(4) NOT NULL default '',
`age` varchar(4) NOT NULL default '',
`gnsa16` varchar(15) NOT NULL default '',
`d11` varchar(3) NOT NULL default '',
`d12` varchar(3) NOT NULL default '',
`d21` varchar(3) NOT NULL default '',
`d22` varchar(3) NOT NULL default '',
`d31` varchar(3) NOT NULL default '',
`d32` varchar(3) NOT NULL default '',
`d41` varchar(3) NOT NULL default '',
`d42` varchar(3) NOT NULL default '',
`d51` varchar(3) NOT NULL default '',
`d52` varchar(3) NOT NULL default '',
`d61` varchar(3) NOT NULL default '',
`d62` varchar(3) NOT NULL default '',
`d71` varchar(3) NOT NULL default '',
`d72` varchar(3) NOT NULL default '',
`d81` varchar(3) NOT NULL default '',
`d82` varchar(3) NOT NULL default '',
`d91` varchar(3) NOT NULL default '',
`d92` varchar(3) NOT NULL default '',
`d101` varchar(3) NOT NULL default '',
`d102` varchar(3) NOT NULL default '',
`d111` varchar(3) NOT NULL default '',
`d112` varchar(3) NOT NULL default '',
`d121` varchar(3) NOT NULL default '',
`d122` varchar(3) NOT NULL default '',
`d131` varchar(3) NOT NULL default '',
`d132` varchar(3) NOT NULL default '',
`rounds` varchar(15) NOT NULL default '',
`avglowest` varchar(15) NOT NULL default '',
`avgall` varchar(15) NOT NULL default '',
`n11` varchar(3) NOT NULL default '',
`n12` varchar(3) NOT NULL default '',
`n21` varchar(3) NOT NULL default '',
`n22` varchar(3) NOT NULL default '',
`n23` varchar(3) NOT NULL default '',
`n31` varchar(3) NOT NULL default '',
`n32` varchar(3) NOT NULL default '',
`n41` varchar(3) NOT NULL default '',
`n42` varchar(3) NOT NULL default '',
`n51` varchar(3) NOT NULL default '',
`n52` varchar(3) NOT NULL default '',
`n61` varchar(3) NOT NULL default '',
`n62` varchar(3) NOT NULL default '',
`sa1801` varchar(3) NOT NULL default '',
`sa1802` varchar(3) NOT NULL default '',
`sa1803` varchar(3) NOT NULL default '',
`sa1804` varchar(3) NOT NULL default '',
`sa1601` varchar(3) NOT NULL default '',
`sa1602` varchar(3) NOT NULL default '',
`sa1603` varchar(3) NOT NULL default '',
`sa1604` varchar(3) NOT NULL default '',
`sa1401` varchar(3) NOT NULL default '',
`sa1402` varchar(3) NOT NULL default '',
`sa1403` varchar(3) NOT NULL default '',
`sa1404` varchar(3) NOT NULL default '',
`sa1201` varchar(3) NOT NULL default '',
`sa1202` varchar(3) NOT NULL default '',
`sa1203` varchar(3) NOT NULL default '',
`sa1204` varchar(3) NOT NULL default '',
`gn01` varchar(3) NOT NULL default '',
`gn02` varchar(3) NOT NULL default '',
`gn03` varchar(3) NOT NULL default '',
`gn04` varchar(3) NOT NULL default '',
PRIMARY KEY (`ID`)
) TYPE=MyISAM COMMENT='Game Organisation' AUTO_INCREMENT=22 ;

# --------------------------------------------------------

I have the following questions:

How is the auto increment value determined?
What exactly does this line do in laymans terms for the MySql to upload and be succesful?

I am sure there is a whiz kid amoungst you that can help.


__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 08-23-2009, 12:16 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

The autoincrement should have no argument
TYPE=MyISAM COMMENT='Game Organisation' AUTO_INCREMENT ;

meaning that each new record takes the next number in the table.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 08-23-2009, 12:26 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Question Re: How do I determine the auto increment value

Hi George,

Thanks for the reply.

I hope my understanding is correct and that the auto_increment = . . . does not need to be stated.

If it is not stated does it know when to stop?
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 08-23-2009, 12:34 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

Rob, i don't know whatyour understanding of MYSQl is.

The AUTOINCREMENT statement simply says MySQL that whenever a new record is added, the column ID (in your case) should assume the first available value
So if you have already inserted in example 20 records (which means 20 players) , in the next record (next player) the ID column will automatically have the value 21.
As simple as that.

So i don't really understand your question "How does it know when to stop"
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 08-23-2009, 12:42 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

My knowledge here is extremely limited.

Trail and error as usaul.

I was having the understanding that should there be a statement like

INSERT INTO 'strokeaverage' VALUES (1,d11,25)
INSERT INTO 'strokeaverage' VALUES (2,d12,26)
INSERT INTO 'strokeaverage' VALUES (3,d21,27)

etc etc

the result would be that in conjunction with these files (3 off) it would have a autoincrement of 4 to now when to stop asking for new values.

I am trying to load this info as a table to my database so maybe that info can helpyou understand where I am at
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 08-23-2009, 12:49 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

An "insert" statement must specify both column names and values, unless the values passed equals the number of columns. So you above insert statements are invalid since you are passing only three values in a table that has 50 + columns.
How would MySQL know in which column it will need to store each value ?

And, you are not saying, is these values (in your last post) intended to be stored in the same row (player) or in different rows ?

I'm sorry but i just can't understand what you are trying to do.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 08-23-2009, 12:55 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

I have a table that i have been using in excel and that table generates stroke averages "averages" for scores that golfers have played.

I want to create interactivity on my website that if I add a score then it will go to the table and then should I need to see the average it will appear on a prepared page.

The info shown below is the field name that they are different.

If there is an easier way the I would appreciate to now - as you can see it is going to take me time in the manner I am currently moving.

I would be more than glad to send my excel apreadsheet of that would assit you.
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old 08-23-2009, 01:00 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

Herewith some additional info.

#
# Table structure for table `strokeaverages`
#
CREATE TABLE `strokeaverage` (
`ID` int(5) NOT NULL auto_increment,
`no` varchar(10) NOT NULL default '',
`gender` varchar(1) NOT NULL default '',
`surname` varchar(25) NOT NULL default '',
`name` varchar(25) NOT NULL default ",
`concat` varchar(50) NOT NULL default ",
`2009` varchar(4) NOT NULL default '',
`age` varchar(4) NOT NULL default '',
`gnsa16` varchar(15) NOT NULL default '',
`d11` varchar(3) NOT NULL default '',
`d12` varchar(3) NOT NULL default '',
`d21` varchar(3) NOT NULL default '',
`d22` varchar(3) NOT NULL default '',
`d31` varchar(3) NOT NULL default '',
`d32` varchar(3) NOT NULL default '',
`d41` varchar(3) NOT NULL default '',
`d42` varchar(3) NOT NULL default '',
`d51` varchar(3) NOT NULL default '',
`d52` varchar(3) NOT NULL default '',
`d61` varchar(3) NOT NULL default '',
`d62` varchar(3) NOT NULL default '',
`d71` varchar(3) NOT NULL default '',
`d72` varchar(3) NOT NULL default '',
`d81` varchar(3) NOT NULL default '',
`d82` varchar(3) NOT NULL default '',
`d91` varchar(3) NOT NULL default '',
`d92` varchar(3) NOT NULL default '',
`d101` varchar(3) NOT NULL default '',
`d102` varchar(3) NOT NULL default '',
`d111` varchar(3) NOT NULL default '',
`d112` varchar(3) NOT NULL default '',
`d121` varchar(3) NOT NULL default '',
`d122` varchar(3) NOT NULL default '',
`d131` varchar(3) NOT NULL default '',
`d132` varchar(3) NOT NULL default '',
`rounds` varchar(15) NOT NULL default '',
`avglowest` varchar(15) NOT NULL default '',
`avgall` varchar(15) NOT NULL default '',
`n11` varchar(3) NOT NULL default '',
`n12` varchar(3) NOT NULL default '',
`n21` varchar(3) NOT NULL default '',
`n22` varchar(3) NOT NULL default '',
`n23` varchar(3) NOT NULL default '',
`n31` varchar(3) NOT NULL default '',
`n32` varchar(3) NOT NULL default '',
`n41` varchar(3) NOT NULL default '',
`n42` varchar(3) NOT NULL default '',
`n51` varchar(3) NOT NULL default '',
`n52` varchar(3) NOT NULL default '',
`n61` varchar(3) NOT NULL default '',
`n62` varchar(3) NOT NULL default '',
`sa1801` varchar(3) NOT NULL default '',
`sa1802` varchar(3) NOT NULL default '',
`sa1803` varchar(3) NOT NULL default '',
`sa1804` varchar(3) NOT NULL default '',
`sa1601` varchar(3) NOT NULL default '',
`sa1602` varchar(3) NOT NULL default '',
`sa1603` varchar(3) NOT NULL default '',
`sa1604` varchar(3) NOT NULL default '',
`sa1401` varchar(3) NOT NULL default '',
`sa1402` varchar(3) NOT NULL default '',
`sa1403` varchar(3) NOT NULL default '',
`sa1404` varchar(3) NOT NULL default '',
`sa1201` varchar(3) NOT NULL default '',
`sa1202` varchar(3) NOT NULL default '',
`sa1203` varchar(3) NOT NULL default '',
`sa1204` varchar(3) NOT NULL default '',
`gn01` varchar(3) NOT NULL default '',
`gn02` varchar(3) NOT NULL default '',
`gn03` varchar(3) NOT NULL default '',
`gn04` varchar(3) NOT NULL default '',
PRIMARY KEY (`ID`)
) TYPE=MyISAM COMMENT='Domestic Stroke Averages' AUTO_INCREMENT=71 ;
# --------------------------------------------------------
#
# Dumping data for table `strokeaverage`
#
INSERT INTO `strokeaverage` VALUES (1,'d11', 9);
INSERT INTO `strokeaverage` VALUES (2,'d12', 10);
INSERT INTO `strokeaverage` VALUES (3,'d21', 11);
INSERT INTO `strokeaverage` VALUES (4,'d22', 12);
INSERT INTO `strokeaverage` VALUES (5,'d31',13);
INSERT INTO `strokeaverage` VALUES (6,'d32',14);
INSERT INTO `strokeaverage` VALUES (7,'d41', 15);
INSERT INTO `strokeaverage` VALUES (8,'d42', 16);
INSERT INTO `strokeaverage` VALUES (9,'d51', 17);
INSERT INTO `strokeaverage` VALUES (10,'d52',1;
INSERT INTO `strokeaverage` VALUES (11,'d61',19);
INSERT INTO `strokeaverage` VALUES (12,'d62',20);
INSERT INTO `strokeaverage` VALUES (13,'d71',21);
INSERT INTO `strokeaverage` VALUES (14,'d72',22);
INSERT INTO `strokeaverage` VALUES (15,'d81',23);
INSERT INTO `strokeaverage` VALUES (16,'d82',24);
INSERT INTO `strokeaverage` VALUES (17,'d91',25);
INSERT INTO `strokeaverage` VALUES (18,'d92',26);
INSERT INTO `strokeaverage` VALUES (19,'d101',27);
INSERT INTO `strokeaverage` VALUES (20,'d102',2;
INSERT INTO `strokeaverage` VALUES (21,'d121',29);
INSERT INTO `strokeaverage` VALUES (22,'d122',30);
INSERT INTO `strokeaverage` VALUES (23,'d131',31);
INSERT INTO `strokeaverage` VALUES (24,'d132',32);
INSERT INTO `strokeaverage` VALUES (25,'n11',36);
INSERT INTO `strokeaverage` VALUES (26,'n12',37);
INSERT INTO `strokeaverage` VALUES (27,'n21',3;
INSERT INTO `strokeaverage` VALUES (28,'n22',39);
INSERT INTO `strokeaverage` VALUES (29,'n31',40);
INSERT INTO `strokeaverage` VALUES (30,'n32',41);
INSERT INTO `strokeaverage` VALUES (31,'n41',42);
INSERT INTO `strokeaverage` VALUES (32,'n42',43);
INSERT INTO `strokeaverage` VALUES (33,'n51',44);
INSERT INTO `strokeaverage` VALUES (34,'n52',45);
INSERT INTO `strokeaverage` VALUES (35,'n61',46);
INSERT INTO `strokeaverage` VALUES (36,'n62',47);
INSERT INTO `strokeaverage` VALUES (37,'sa1801',4;
INSERT INTO `strokeaverage` VALUES (38,'sa1802',49);
INSERT INTO `strokeaverage` VALUES (39,'sa1803',50);
INSERT INTO `strokeaverage` VALUES (40,'sa1804',51);
INSERT INTO `strokeaverage` VALUES (41,'sa1601',52);
INSERT INTO `strokeaverage` VALUES (42,'sa1602',53);
INSERT INTO `strokeaverage` VALUES (43,'sa1603',54);
INSERT INTO `strokeaverage` VALUES (44,'sa1604',55);
INSERT INTO `strokeaverage` VALUES (45,'sa1401',56);
INSERT INTO `strokeaverage` VALUES (46,'sa1402',57);
INSERT INTO `strokeaverage` VALUES (47,'sa1403',5;
INSERT INTO `strokeaverage` VALUES (48,'sa1404',59);
INSERT INTO `strokeaverage` VALUES (49,'sa1201',60);
INSERT INTO `strokeaverage` VALUES (50,'sa1202',61);
INSERT INTO `strokeaverage` VALUES (51,'sa1203',62);
INSERT INTO `strokeaverage` VALUES (52,'sa1204',63);
INSERT INTO `strokeaverage` VALUES (53,'gn01',64);
INSERT INTO `strokeaverage` VALUES (54,'gn02',65);
INSERT INTO `strokeaverage` VALUES (55,'gn03',66);
INSERT INTO `strokeaverage` VALUES (56,'gn04',67);



Posting this in phpadmin and trying to upload as a txt file creates an error

So it is more than likely not quite correct or the file is too big
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old 08-23-2009, 01:06 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

Sorry Rob, i don't have the time to do this.

You need to plan what the table structure will be in relationship to your excel table.

The simplest way i can see is that you have in both the same structure, and then, after updating the excel file, you export it in csv format wich you then import in the MySQL table through phpMyAdmin. Of course you will need to empty the table completely before you upload the updated csv. Otherwise you should also have some code that would checkthe new values and instead of "insert" ing it would "update" the table correctly.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old 08-23-2009, 01:13 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

Thanks for the advice.

I have tried loading the CSV file previously but also had some problems in loading.

Maybe becuase I was loading it with all the data and you are saying I shouldnt do that at first.

Once the csv file it loaded to mySql do i then create the form to populate the data ?
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old 08-23-2009, 01:45 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

Rob, you are confusing me.

If you load the data directly from your (updated) Excel csv file, what would you need a form for ?

I'm not yet sure what you are trying to do. Do you ONLY want to display the info ? if yes, you don't need a MySQL database. Simply create a script that will read the csv file (that you will need to upload on the site using FTP) and let the script simply display the info.

A MySQL table would only be needed if you wat to add single entries 8(ach tournaments results) and have MySQL in conjunction with a php script calculate averages and display them.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old 08-23-2009, 01:51 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

hi George,

I will be uploading new tournament dat later and thus the MySql option is what we have in mind.

I have tried loading the csv file but error #1064 persists
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old 08-23-2009, 01:54 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

You can't just upload a scv file. It needs to be formatted in a specific way so that it can be loaded into a pre-made table.

I suggest that you read some MySQL tutorials on importing csv files.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old 08-23-2009, 01:57 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

So then if i understand correctly by removing all the data form the excel spreadsheet and leaving only the titlesof each columns(field name) and saving it as csv.

I have read some posts in the forum.

I then import the saved csv file through phpadmin.

Or is this process even more complex?
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old 08-23-2009, 02:03 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

The simplest way to import a csv file is this:

1. Create a table that has EXCACTLY the same structure (column names, type of data etc) as your Excel file.
2. Upload this csv file in your server.
3. Create a simple php script that will:
a. Empty the table
b. Read the file records
c. insert each csv row in a MySQL row.

I don't understand however: if you already have to do this work in your desktop (Excel) why do you need to insert the same dat ain your MySQl ?

As i said, instead of the above, the php script could simply read the CSV file (as if it was reading drom MySQL) and display the data in your page.
After all, a CSV file has the same structure as a MySQL table.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old 08-23-2009, 02:04 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Question Re: How do I determine the auto increment value

Hi George,

Sorry for all the questions.

If i take the information listed in small blue text below and post it under the Run sql query/queries on database "eghfya_DOOM" and then press GO

Would this not create the table I am looking to create under the Database above?
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old 08-23-2009, 02:08 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

I didn't examine it for syntax errors. If it is correct, then yes, it will create the table.

I mean only the first part, up to

TYPE=MyISAM COMMENT='Domestic Stroke Averages' AUTO_INCREMENT=71 ;

Without the =71 part
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18  
Old 08-23-2009, 02:12 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Thumbs up Re: How do I determine the auto increment value

Hi George,

I am glad as that was my understanding and the first task at hand

-create the table.

It comes up with an error when I do it this way so either it takes to long or the file syntax as you describe it is wrong.

Thaks for taking the time and helping me - it is appreciated
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19  
Old 08-23-2009, 02:38 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Thumbs up Re: How do I determine the auto increment value

Hi George,

NOt working for me - keeps giving me line errors.
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #20  
Old 08-23-2009, 03:57 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

CREATE TABLE `strokeaverage` (
`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`no` varchar(10) NOT NULL default '',
`gender` varchar(1) NOT NULL default '',
`surname` varchar(25) NOT NULL default '',
`name` varchar(25) NOT NULL default ",
`concat` varchar(50) NOT NULL default ",
`2009` varchar(4) NOT NULL default '',
`age` varchar(4) NOT NULL default '',
`gnsa16` varchar(15) NOT NULL default '',
`d11` varchar(3) NOT NULL default '',
`d12` varchar(3) NOT NULL default '',
`d21` varchar(3) NOT NULL default '',
`d22` varchar(3) NOT NULL default '',
`d31` varchar(3) NOT NULL default '',
`d32` varchar(3) NOT NULL default '',
`d41` varchar(3) NOT NULL default '',
`d42` varchar(3) NOT NULL default '',
`d51` varchar(3) NOT NULL default '',
`d52` varchar(3) NOT NULL default '',
`d61` varchar(3) NOT NULL default '',
`d62` varchar(3) NOT NULL default '',
`d71` varchar(3) NOT NULL default '',
`d72` varchar(3) NOT NULL default '',
`d81` varchar(3) NOT NULL default '',
`d82` varchar(3) NOT NULL default '',
`d91` varchar(3) NOT NULL default '',
`d92` varchar(3) NOT NULL default '',
`d101` varchar(3) NOT NULL default '',
`d102` varchar(3) NOT NULL default '',
`d111` varchar(3) NOT NULL default '',
`d112` varchar(3) NOT NULL default '',
`d121` varchar(3) NOT NULL default '',
`d122` varchar(3) NOT NULL default '',
`d131` varchar(3) NOT NULL default '',
`d132` varchar(3) NOT NULL default '',
`rounds` varchar(15) NOT NULL default '',
`avglowest` varchar(15) NOT NULL default '',
`avgall` varchar(15) NOT NULL default '',
`n11` varchar(3) NOT NULL default '',
`n12` varchar(3) NOT NULL default '',
`n21` varchar(3) NOT NULL default '',
`n22` varchar(3) NOT NULL default '',
`n23` varchar(3) NOT NULL default '',
`n31` varchar(3) NOT NULL default '',
`n32` varchar(3) NOT NULL default '',
`n41` varchar(3) NOT NULL default '',
`n42` varchar(3) NOT NULL default '',
`n51` varchar(3) NOT NULL default '',
`n52` varchar(3) NOT NULL default '',
`n61` varchar(3) NOT NULL default '',
`n62` varchar(3) NOT NULL default '',
`sa1801` varchar(3) NOT NULL default '',
`sa1802` varchar(3) NOT NULL default '',
`sa1803` varchar(3) NOT NULL default '',
`sa1804` varchar(3) NOT NULL default '',
`sa1601` varchar(3) NOT NULL default '',
`sa1602` varchar(3) NOT NULL default '',
`sa1603` varchar(3) NOT NULL default '',
`sa1604` varchar(3) NOT NULL default '',
`sa1401` varchar(3) NOT NULL default '',
`sa1402` varchar(3) NOT NULL default '',
`sa1403` varchar(3) NOT NULL default '',
`sa1404` varchar(3) NOT NULL default '',
`sa1201` varchar(3) NOT NULL default '',
`sa1202` varchar(3) NOT NULL default '',
`sa1203` varchar(3) NOT NULL default '',
`sa1204` varchar(3) NOT NULL default '',
`gn01` varchar(3) NOT NULL default '',
`gn02` varchar(3) NOT NULL default '',
`gn03` varchar(3) NOT NULL default '',
`gn04` varchar(3) NOT NULL default '')
TYPE=MyISAM COMMENT='Domestic Stroke Averages';

What are you trying to do with these lines?

`name` varchar(25) NOT NULL default ",
`concat` varchar(50) NOT NULL default ",


?

As you have it, it giìves the "name" column the default value concat` varchar(50) NOT NULL default

which i don't understand.

Also, it is controversial that you assign the NOT NULL property but you set as default ''
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #21  
Old 08-23-2009, 04:04 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

Thanks for the reply.
  1. The name is the persons first name
  2. The 'concat' would have been the combination of both surname and name as I had on my spreadsheet. I guess this is no longer required as it can be done by a script.
With regards to the NOT NULL Defaults - I do not know what is correct or not correct - as I do not know the actual requirement.

The stuff in () I understand is the amount of characters that is required for the field.

thanks for taking the time again
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #22  
Old 08-23-2009, 04:08 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

The above query as i have posted it is functional. However it will set the NOT NULL columns to NOT NULL, which means that MySQL will deny a new insert if no value exists (at least a ' ' white space should be entered)

Just delete the NOT NULL from the query and you will be ok.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #23  
Old 08-23-2009, 04:17 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

Thanks for the support - much appreciated.

I I understand correctly in the origanl "blue Text" there should have been a space

i.e `d12` varchar(3) NOT NULL default ' ',

and it should not read as

`d12` varchar(3) NOT NULL default '',
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #24  
Old 08-23-2009, 04:20 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

Correct. BUT there is no reason to set the column to NOT NULL, if you need to insert at least the white space.

When you insert / update records in a MySQL through a php script, it is the script that should perform a validation and allow or disallow an empty value. This way you also have control over the error message that will be displayed to the user.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #25  
Old 08-23-2009, 04:27 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

I think I am getting the info into my head eventually.

There will be instances when my dat will have open spaces - no inputs and thus the entry would be correct to have spaces.

So would I be correct in suggesting the lines must all be changed to show as:

`d12` varchar(3) NOT NULL default ' ',

or should it be

`d12` varchar(3) default ' ',
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #26  
Old 08-23-2009, 04:51 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: How do I determine the auto increment value

A default is only used when you MUST have a value.

In example a date column can have, as default, now() which will add date and time.

Otherwise it is meaningless.

Just make your query lines

`d12` varchar(3) ,
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #27  
Old 08-23-2009, 04:57 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Default Re: How do I determine the auto increment value

Hi George,

Thanks I will try it like this.
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #28  
Old 08-23-2009, 05:08 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Thumbs up Re: How do I determine the auto increment value

Hi George,

Table created - thanks very much
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT +1. The time now is 07:44 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2005-2009 VodaHost Web Hosting Your Perfect Web Host - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203