Thanks for the reply bubblenut.
That still didn't work, but I see where you're going. I looked over like 5 or 6 different examples of the mysql INSERT command, and never saw data in quotes.
Here is the layout of the table which I'm trying to input data to:
mysql> use movies;
Database changed
mysql> describe grossRevenue;
+---------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------+------+-----+---------+-------+
| revenue | bigint(20) | YES | MUL | NULL | |
| title | char(100) | YES | MUL | NULL | |
| year | int(11) | YES | | NULL | |
| viewed | tinyint(4) | YES | | 0 | |
+---------+------------+------+-----+---------+-------+
4 rows in set (0.09 sec)
mysql>
Do all of the data types need quotes?
These commands are working on my server:
mysql> SELECT * FROM grossRevenue;
Empty set (0.00 sec)
mysql> INSERT INTO grossRevenue VALUES ( 656, 'the space works', 4564, 4 );
Query OK, 1 row affected (6.49 sec)
mysql> INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( 825, 'a new entry is cool', 23423 );
Query OK, 1 row affected (1.21 sec)
mysql>
Here are some of the query strings that I have tried:
$querystring = "INSERT INTO grossRevenue VALUES ( ".$items[0].", '".$items[1]."', ".$items[2].", ".$line_num." )";
INSERT INTO grossRevenue VALUES ( 601, 'Titanic ', 1997 , 0 )
$querystring = "INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( ".$items[0].", '".$items[1]."', ".$items[2]." )";
INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( 601, 'Titanic ', 1997 )
$querystring = "INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( '".$items[0]."', '".$items[1]."', '".$items[2]."' )";
INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( '404', 'Spider-Man ', '2002 ' )
$querystring = "INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( \"".$items[0]."\", \"".$items[1]."\", \"".$items[2]."\" )";
INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( "340", "The Lord of the Rings: The Two Towers ", "2002 " )
$querystring = "INSERT INTO grossRevenue ( 'revenue', 'title', 'year' ) VALUES ( '".$items[0]."', '".$items[1]."', '".$items[2]."' )";
INSERT INTO grossRevenue ( 'revenue', 'title', 'year' ) VALUES ( '340', 'The Lord of the Rings: The Two Towers ', '2002 ' )
$querystring = "INSERT INTO grossRevenue ( \"revenue\", \"title\", \"year\" ) VALUES ( \"".$items[0]."\", \"".$items[1]."\", \"".$items[2]."\" )";
INSERT INTO grossRevenue ( "revenue", "title", "year" ) VALUES ( "340", "The Lord of the Rings: The Two Towers ", "2002 " )
$querystring = "INSERT INTO grossRevenue ( \"revenue\", \"title\", \"year\" ) VALUES ( ".$items[0].", \"".$items[1]."\", ".$items[2]." )";
INSERT INTO grossRevenue ( "revenue", "title", "year" ) VALUES ( 357, "Jurassic Park ", 1993 )
$querystring = "INSERT INTO grossRevenue VALUES ( '444', 'second cool', '56555', '5' )";
INSERT INTO grossRevenue VALUES ( '444', 'second cool', '56555', '5' )
With no variables.
$querystring = "INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( 444, 'second cool', 56555 )";
INSERT INTO grossRevenue ( revenue, title, year ) VALUES ( 444, 'second cool', 56555 )
$querystring = "INSERT INTO grossRevenue VALUES ( 444, 'second cool', 56555, 5 )";
INSERT INTO grossRevenue VALUES ( 444, 'second cool', 56555, 5 )
What I really need is to read a good paper on the syntax rules for the mysql insert command.
Does anyone know of one that they could share? The pdf manual I got from the mysql.com site,
lists the syntax for the INSERT command on page 625, it actually begins on 626, and the PDF
page is 657. It doesn't cover quotation that I can find.
please help -