Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 22-01-03
frostie
Guest
 
Posts: n/a
  PHP Question - simply but cant find the answer


OK, finally I have completed all my php pages, and completed the design of mySQL database

So far, chuffed to bits with what I have managed to teach myself in under 1 week <img src=http://www.gamers-forums.com/smilies/contrib/ruinkai/biggthumpup.gif ALT=":thumb">

Now the final hurdle...... I want to insert all my data into the table and I know it goes like;

INSERT tablename (colname1, colname2, colname3)
VALUES ('val1', 'val2', 'val3')

But that is only for 1 row, if I wanted to add another to exactly the same table, how do I add new values, or do I have to add the INSERT line again?

Ta
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 22-01-03
ShowYouLoveThem
Guest
 
Posts: n/a
  Re: PHP Question - simply but cant find the answer


If you have space on your server, I'd install phpMyAdmin as it makes managing MySql database so much easier.

Multiple inserts is one way; if you are just putting data in by hand, this is probably easiest as it is easier to fix if it goes wrong (i.e. you miss out a ').

If you have a text/csv file you want to import have a look at :- www.mysql.com/doc/en/LOAD_DATA.html, I haven't used that method, but its the why phpMyAdmin does it in the background.

php???? programs seem to be good - even though they are separate projects. I use phpMySql, phpAdsNew (For managing adverts, as seen at the top of the page) and phpBB2 (a php/MySql based forum).

Nice to have another php hacker amongst us!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 22-01-03
frostie
Guest
 
Posts: n/a
  Re: PHP Question - simply but cant find the answer


SYLT thanks for that, I will be taking a look at the other options later, but how do you do the insert command with more than 1 set of values (ie, to create 3 rows)?

Is it possible?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 22-01-03
ShowYouLoveThem
Guest
 
Posts: n/a
  Re: PHP Question - simply but cant find the answer


I haven't tried it, but from just scanning the manual it looks like
Code:
 INSERT tablename (colname1, colname2, colname3)
VALUES ('val1a', 'val2a', 'val3a'), ('val1b', 'val2b', 'val3b'), ('val1c', 'val2c', 'val3c')
will work if you have MySql version 3.22.5 or later. Just repeat ('val1', 'val2', 'val3') for as many rows as you want.

If this doesn't work (i.e you have an earlier version), then use multiple inserts.

www.mysql.com/doc/en/INSERT.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 22-01-03
frostie
Guest
 
Posts: n/a
  Re: PHP Question - simply but cant find the answer


THANK YOU !!! <img src=http://www.gamers-forums.com/smilies/contrib/ruinkai/biggthumpup.gif ALT=":thumb">

It worked a treat :rollin:
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP redirect question drivetowin Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 1 31-12-04 04:44 PM
Shopping Channel / PHP Question. draytop Affiliate Window 0 09-08-04 03:05 PM
PHP question......again :) uklejon Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 6 11-05-04 04:07 PM
PHP and MySQL - Find and Replace - Update Barry Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 2 26-04-04 03:16 PM
Question about @ prefix in php darrenw Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 2 28-03-04 04:40 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7