Re: Problem with adding quotations to a mysql insert statement
| From: | Sven | Date: | Mon, 15 Dec 2003 14:36:06 +0000 |
| Subject: | Re: Problem with adding quotations to a mysql insert statement | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172735@lists.php.net to get a copy of this message | ||
Richard Kurth schrieb:
I need to add extra quotation marks in to the following insert command for mysql. I need one that is part of the info right before the |$wrapper resend and right after the $outgoing,nobody $query = "insert into majordomoaliases (domain,listname,var,address1,address2)values (/"$domname/",\"$listname\",\"a\",\"$listdomain-$listname:\",\" |$wrapper resend -C $domaincf -l $listname -h $listdomain $listdomain-$listname-$outgoing,nobody\")"; The whole line should look like this when it is printed out to the page it will be written to from the database "|/var/wrapper resend -C /var/domaincf -l list1 -h domain.com domain.com-list1-outgoing,nobody" I am totaly stuped on haw to add this extra quotation mark no mater what I do I get mysql errors.hi richard, take a look at mysql-manual /6 MySQL Language Reference /6.1 Language Structure /6.1.1 Literals: How to Write Strings and Numbers
/6.1.1.1 Strings
"A "' inside a string quoted with "' may be written as `""'."
so for your query:
$query = "insert into majordomoaliases (domain, listname, var, address1, address2) values (\"$domname\", \"$listname\", \"a\", \"$listdomain-$listname:\", \" \"\"$wrapper resend -C $domaincf -l $listname -h $listdomain $listdomain-$listname-$outgoing,nobody\"\"\")";
hth SVEN