Re: Problem with php and MySQL: inserting strings into database
| From: | Toby Hart Dyke | Date: | Fri, 23 Apr 2010 09:44:40 +0000 |
| Subject: | Re: Problem with php and MySQL: inserting strings into database | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-30045@lists.php.net to get a copy of this message | ||
Apart from Warren's excellent advice, the source of your problem is things like this:
'$_POST['vorname']'
How is PHP supposed to know that this is nested parentheses? You should have done it like this:
"$_POST['vorname']"
Though of course, follow Warren's advice, and don't do it like this at all ;-)
Toby
On 4/23/2010 6:34 AM, Alexander Schunk wrote:
Hello, i have a problem with php and mysql when inserting strings into a database. I have the following syntax: $sqlinsert = "INSERT INTO werte ('benutzername', 'passwort', 'name', 'vorname', 'Geburtsdatum', 'strasse', 'plz', 'ort', 'email') VALUES('$_POST['benutzername']', '$_POST['passwort']', '$_POST['name']', '$_POST['vorname']', '$_POST['Geburtsdatum']', '$_POST['straße']', '$_POST['plz']', '$_POST['ort']', '$_POST['email']')"; I am getting an unexpected T_STRING .... error.