Well first, I don't know if you copied and pasted directly from your file,
but you're building your query in the variable $sql AFTER you run the query:
mysql_query($sql) or die(msql_error());
$sql = "Insert into table ('$field1','$field2',....,'$field61')";
It should be:
$sql = "Insert into table ('$field1','$field2',....,'$field61')";
mysql_query($sql) or die(msql_error());
However, you should also use the coding practice of:
$sql = "INSERT INTO table SET
NameOfField1='ValueOfField2',Field2='Value',Field3='Value', etc....;"
It's a little easier to read and understand. Note that you don't really have
to do anything special to be able to separate the query onto multiple lines:
$sql = "INSERT INTO
table
SET
field='value',
field2='value';
";
mysql_query($sql) or die(msql_error());
... will work fine. No need for special characters - PHP will recognize
values and strings that are on multiple lines AS LONG AS the value starts
and ends with quotes (and the semicolon at the end).
- Jonathan
-----Original Message-----
From: Ethan J. Mings [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 9:11 AM
To: Jonathan Hilgeman
Subject: Re[2]: [PHP-DB] Insert into command - PHP
PHP-DB Mailing List
Hello Jonathan,
--
Friday, March 29, 2002, 11:53:31 AM, you wrote:
> ...after you have run the query. Give us the output and your query and we
> can help a bit more.
Hi, thanks for the follow up.
I included the following command in the line...
mysql_query($sql) or die(msql_error());
$sql = "Insert into table ('$field1','$field2',....,'$field61')";
The message returned was, "Query was empty"
I am suspect of the 61 fields. The line travels far out to the right.
Is there a way to properly code the line so it does not go so far to
the right.
Otherwise, no other report errors.
--
Ethan J. Mings
Office E-mail [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php