Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #17537
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Where did the parens come from |
| Date | 2017-07-11 12:55 -0500 |
| Message-ID | <slrnoma485.4ah.hellsop@nibelheim.ninehells.com> (permalink) |
| References | <ok0gfs$1pkp$1@gioia.aioe.org> <ok108o$pgf$1@jstuckle.eternal-september.org> <ok2d24$h9s$3@gioia.aioe.org> <ok2ik8$tjc$1@jstuckle.eternal-september.org> <ok2n6c$1207$1@gioia.aioe.org> |
On Tue, 11 Jul 2017 10:26:19 -0400, bill wrote:
> Here is the current code.
> ----------------------
> //---------------------------------------------------------page 1
> of a dog needs help -------------------
> function mSavePersonData($postData) { // mSavePersonData
> global $connection;
> // $postData contains the $_POST data from rescueDog1.php
>
> $sql = "INSERT INTO `dogs`
> (`hName`,
> `street`,
> `city`,
> `state`,
> `zip`,
> `hPhone`,
> `wPhone`,
> `cPhone`,
> `email`
> )
> VALUES (
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})',
> '$connection->real_escape_string({$postData['hName']})'
> )
> ";
> echo basename(__FILE__) . ": " . __LINE__ . ": sql=>$sql<br />";
> $result =mysqli_query($connection, $sql);
> if (!$result) die("MySql ERROR in dogs-basic: ".__FUNCTION__."
> on line " . __LINE__ . " " . $connection->error);
> ----------------------
>
> interestingly, when the function runs the sql row generated has
> the parens.
For giggles, try this:
function mSavePersonData($postData) { // mSavePersonData
global $connection;
// $postData contains the $_POST data from rescueDog1.php
$sql = "INSERT INTO `dogs`
(`hName`,
`street`,
`city`,
`state`,
`zip`,
`hPhone`,
`wPhone`,
`cPhone`,
`email`
)
VALUES (
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})}',
'{$connection->real_escape_string({$postData['hName']})'
)
";
Because that's how it's shown on the manual page for the string types.
There are no object variables that I can see that are both interpreted
inside quoted strings that aren't also brace-wrapped at the object
level.
It's also killing me inside that all the indexes are 'hName' and not
'street', 'city', etc.
--
"This system operates under martial law. The constitution is suspended.
You have no rights except as declared by the area commander. Violators
will be shot. Repeat violators will be repeatedly shot...."
-from "A_W_O_L"
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Where did the parens come from bill <william@TechServSys.com> - 2017-07-10 14:19 -0400
Re: Where did the parens come from "J.O. Aho" <user@example.net> - 2017-07-10 21:17 +0200
Re: Where did the parens come from bill <william@TechServSys.com> - 2017-07-11 07:31 -0400
Re: Where did the parens come from "J.O. Aho" <user@example.net> - 2017-07-11 18:05 +0200
Re: Where did the parens come from Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-10 18:53 -0400
Re: Where did the parens come from bill <william@TechServSys.com> - 2017-07-11 07:29 -0400
Re: Where did the parens come from bill <william@TechServSys.com> - 2017-07-11 07:33 -0400
Re: Where did the parens come from Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-11 09:12 -0400
Re: Where did the parens come from bill <william@TechServSys.com> - 2017-07-11 10:26 -0400
Re: Where did the parens come from "Peter H. Coffin" <hellsop@ninehells.com> - 2017-07-11 12:55 -0500
Re: Where did the parens come from "Peter H. Coffin" <hellsop@ninehells.com> - 2017-07-11 13:52 -0500
Re: Where did the parens come from Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-11 14:57 -0400
Re: Where did the parens come from bill <william@TechServSys.com> - 2017-07-12 08:03 -0400
Re: Where did the parens come from "Peter H. Coffin" <hellsop@ninehells.com> - 2017-07-12 13:51 -0500
Re: Where did the parens come from bill <william@TechServSys.com> - 2017-07-13 07:37 -0400
Re: Where did the parens come from "R.Wieser" <address@not.available> - 2017-07-11 08:40 +0200
csiph-web