Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Peter H. Coffin" Newsgroups: comp.lang.php Subject: Re: Where did the parens come from Date: Tue, 11 Jul 2017 12:55:17 -0500 Lines: 85 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net P9WoxQSUDrg5SsYqD9MyCQW0y4ylMWdFD6xXI+qcnxT0pjFuqj X-Orig-Path: nibelheim.ninehells.com!not-for-mail Cancel-Lock: sha1:1nNP//15KpevHn6lrh/NiQVReLk= User-Agent: slrn/0.9.9p1 (OpenBSD) Xref: csiph.com comp.lang.php:17537 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
"; > $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"