Current location: Hot Scripts Forums » Other Discussions » Database » MySQL 5.0 formating


MySQL 5.0 formating

Reply
  #1 (permalink)  
Old 09-25-09, 01:17 AM
Durakken Durakken is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL 5.0 formating

Hi i need a quick tutorial for formatting something import into MySQL from either .txt and/or open office

there are 12 fields. All the fields, as far as I know, are alphanumeric, but there is 1 or 2 that might need an extra 0 that needs to be able to be left out.

Also as far as I know there will be no mathematics used on this, just a read and list those items that have the term listed in their fields.

I don't know any information needed to help to answer this question as I have not ever used mySQL manually or PHP with mySQL or seriously...

Also the reason I am asking ad not "looking' for the answer through tutorials is because i really don't have the time to try figure it out like that apparently (don't know why that's the case) so please could you show or provide a link to a clear tutorial on this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-25-09, 07:43 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Is it a CSV file?
I posted code here for importing from a CSV look at the newest posts list.
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-25-09, 08:29 PM
Durakken Durakken is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
I can make the file csv, but the file type is default xlr. I don't know how well that converts...

also can't find the psot you are talking about.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-25-09, 09:24 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-27-09, 02:26 AM
Durakken Durakken is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Ok so this is the file... Now to use this do i have to independantly set up the table and fields, or will this create that?

also, any special meaning behind the array and the skip in the array from 4 to 8 in this line "$Phone=$line_of_text[8];"?

and do i load this up to my webhost, load up the file i want converted and then bring up the url? or do i have to do something else?

PHP Code:

<?PHP



mysql_connect
("localhost""Database""Pasword") or die(mysql_error());
mysql_select_db("Table") or die(mysql_error());

$file_handle fopen("MD.csv""r");

while (!
feof($file_handle) ) {

$line_of_text fgetcsv($file_handle1024);

print 
$line_of_text[0] ."<BR>";

$Name=$line_of_text[0];
$Street=$line_of_text[1];
$City=$line_of_text[2];
$State=$line_of_text[3];
$Zipcode=$line_of_text[4];
$Phone=$line_of_text[8];

mysql_query("INSERT INTO Business 
(Name,Street,City,State,Zipcode,Phone) VALUES('
$Name','$Street','$City','$State','$Zipcode','$Phone') "); 



}

fclose($file_handle);

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Useful MySQL Resources ptesone Database 30 02-23-11 09:28 AM
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
MySql Labyrinth moron Database 4 02-22-08 03:46 AM
How to use procedures in MYSQL 5.0 justnajm Database 2 01-03-07 04:20 PM
Keep formating when adding new column to mysql jsad PHP 4 01-05-05 06:43 AM


All times are GMT -5. The time now is 12:56 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.