RE: Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I think it may be the { and } which are used in php

if they are part of the data you are saving then try adding  a \ =>  \{ and
\} if not remove them.

Peter


-----------------------------------------------
Excellence in internet and open source software
-----------------------------------------------
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
-----------------------------------------------







-----Original Message-----
From: Remember14a@xxxxxxx [mailto:Remember14a@xxxxxxx]
Sent: 07 February 2004 19:37
To: php-db@xxxxxxxxxxxxx
Subject:  Question


Dear friends,

On submitting form to mysql database I get a parse error,There is no problem
with connection code, Problem is some where around create the sql statement
Can any one figure out where is the precise error, please.
Following is the code from php file

<?php
// open the connection
$conn = mysql_connect("localhost", "", "");

// pick the database to use
mysql_select_db("testDB",$conn);

// create the SQL statement
$sql = "INSERT INTO testtable values ('{$_POST[testField]}','
{$_POST[testFielda]}','{$_POST[testFieldb]}','{$_POST[testFieldd]}','
{$_POST[testFieldc]}','{$_POST[testFielde]}')";



// execute the SQL statement
if (mysql_query($sql, $conn)) {
    echo "record added!";
} else {
    echo "something went wrong";
}
?>
----------------------------------------------------------------------------
-
Asif

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux