logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: MySQL - INSERT INTO????
Author
kr33



Joined: 19 Sep 2006
Posts: 64
Location: South Africa

PostPosted: Fri 22 Sep '06 11:30    Post subject: MySQL - INSERT INTO???? Reply with quote

Hi

I've recently written a php script to create a new database, create tables for the database, to populate the database with data into each of the respective tables and then query and retrieve the info.

My script successfully creates the database and tables. But it does not populate the tables completely, I have three tables to be exact and only the first table is populated with data, not the rest. Which in turn causes the retrieval of the data to fail. I don't get ANY error messages at all!!!

I'm using the root user name and password to access MySQL. So I have FULL access and rights to ALL functions etc.

Please help Exclamation Question

Thanks
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 22 Sep '06 13:54    Post subject: Reply with quote

Can you post the first line (insert) from the three tables?
Back to top
kr33



Joined: 19 Sep 2006
Posts: 64
Location: South Africa

PostPosted: Fri 22 Sep '06 16:06    Post subject: Reply with quote

well this is what I have

Code:

$insert = INSERT INTO movie (movie_id, movie_name, movie_type," .
              "movie_year, movie_leadactor, movie_director)".
              "VALUES (1, 'XMen', 5, 2003, 1, 2),".
              "(2,'King Authur',5,2001,2)";


Now there are three different tables, this would be the first table, which gets populated, but the others remain empty

Why? And what do I do?

thanks
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 22 Sep '06 16:37    Post subject: Reply with quote

Aftrer creation of the table your SQL should look like

Code:

$insert = "
INSERT INTO `movie` VALUES (1, 'XMen', 5, 2003, 1, 2);
INSERT INTO `movie` VALUES (2,'King Authur', 5, 2001, 2,'');
";


On the seconds INSERT INTO you forget a value so the last one are two singele quotes.

To fill up your DB that way is very uneffectiv. Use phpMyAdmin. That will be easier.
Back to top


Reply to topic   Topic: MySQL - INSERT INTO???? View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner