Re: PHP/MYSQL query error
| From: | Chris Crane | Date: | Mon, 26 Aug 2002 13:50:02 +0000 |
| Subject: | Re: PHP/MYSQL query error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114139@lists.php.net to get a copy of this message | ||
I did some more testing and I found that I forgot the first field in the
columns section of the Statement. So now it looks like this:
I also copy and pasted the statement into PHPMYADMIN and it worked fine. It
just doesn't work here????
function AddSignupRequest($Signup_FName, $Signup_LName, $Signup_Address1,
$Signup_Address2, $Signup_City,
$Signup_State, $Signup_Zip, $Signup_Email, $Signup_Phone,
$Signup_ContactMethod,
$Signup_Date, $Signup_IP, $Signup_Status, $Signup_Comments) {
/* Connecting, selecting database */
$dbh=mysql_connect ($MySQL_Host, $MySQL_User, $MySQL_Password) or die
('I cannot connect to the database.');
mysql_select_db ("havasuin_Signups");
/* Performing SQL query */
$query = "INSERT INTO SignupRequests ('SignupID', 'FirstName',
'LastName', 'Address1', 'Address2',
'City', 'State', 'Zip', 'Email', 'Phone',
'ContactMethod', 'Date',
'IP', 'Status', 'Comments')
VALUES ('', 'Chris', 'Crane', '655 Talcottville Road',
'Apt. 185',
'Vernon', 'CT', '06066', 'ccrane@inxdesign.com',
'860-659-6464', 'Email', 'August 25, 2002',
'64.252.232.82', 'Newly
Requested', 'Testing')";
$result = mysql_query($query) or die("Query failed");
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
print "<br>$Signup_LName, $Signup_FName<br>\n";
}
"Chris Crane" <ccrane@inxdesign.com> wrote in message
news:20020826134136.77666.qmail@pb1.pair.com...
> I am getting a failed query error message. Could someone take a look and
let
> me know.
>
> //F U N C T I O N S
> //=================
> function AddSignupRequest($Signup_FName, $Signup_LName, $Signup_Address1,
> $Signup_Address2, $Signup_City,
> $Signup_State, $Signup_Zip, $Signup_Email, $Signup_Phone,
> $Signup_ContactMethod,
> $Signup_Date, $Signup_IP, $Signup_Status, $Signup_Comments) {
> /* Connecting, selecting database */
> $dbh=mysql_connect ($MySQL_Host, $MySQL_User, $MySQL_Password) or die
> ('I cannot connect to the database.');
> mysql_select_db ("havasuin_Signups");
>
> /* Performing SQL query */
> $query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
> 'Address1', 'Address2',
> 'City', 'State', 'Zip', 'Email',
> 'Phone', 'ContactMethod', 'Date',
> 'IP', 'Status', 'Comments')
> VALUES ('', 'Chris', 'Crane', '655 Talcottville
> Road', 'Apt. 185',
> 'Vernon', 'CT', '06066', 'ccrane@inxdesign.com',
> '860-659-6464', 'Email', 'August 25, 2002',
> '64.252.232.82', 'Newly
> Requested', 'Testing')";
> $result = mysql_query($query) or die("Query failed");
>
> /* Free resultset */
> mysql_free_result($result);
>
> /* Closing connection */
> mysql_close($link);
> print "<br>$Signup_LName, $Signup_FName<br>\n";
>
> }
>
>