Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #2238
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Form fields to database and back? |
| Date | 2011-06-17 21:01 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <itgte0$6pt$1@dont-email.me> (permalink) |
| References | <j48lv6prpshk57ora2dsp6b2lvp16vkvtu@4ax.com> <ite935$1b5$1@dont-email.me> <plelv6lp4m78uv2tg5mjtm9bd5f13douk5@4ax.com> <1655216.aK4W3vaeNJ@PointedEars.de> <sppnv6tecikiudrbhkq4v4rcacioqihvnu@4ax.com> |
On 6/17/2011 7:52 PM, bobmct wrote: > All good points everyone, of course. But with extensive testing today > here's what I had to end up with for consistent results: > > From field to database I used mysql_real_escape_string. > > When I look at the actual data stored in the db field that function > inserted backslashes before each double quote. > Then you have done something else, like used addslashes() somewhere. Alternatively, magic_quotes_gpc may be set on your server (it should NOT be; it has been deprecated for years and will be removed in PHP 6). But mysql_real_escape_string() will not cause backslashes to be added to the data in the database; when you retrieve the data it will be exactly as it originally was. > To display the retrieved db field I ran it through htmlspecialchars() > but the backslashes still remained. I had to use stripslashes to > remove them. > That's because you did something else beforehand which is invalid. > And no, this is NOT a cms. Its a stando alone database update program. > > Works for now. > > And a general comment on nesting functions vs individual lines... > > I've been coding for many decades and quite often, including prior to > this project, I have had to trudge through code written by others. > When one has no idea about the code and no documentation let alone > self documented code, nested functions are difficult to decode. > > Of course it can be done but I've learned that when programs are > running on 16 core 48GB RAM systems, it makes little difference in > performance but a whole LOT of difference for the next person to > understand. > > Just my $.02 worth. PHP does not allow nested functions. I'm not sure where that came up (you didn't quote the relevant text). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Form fields to database and back? bobmct <bobm3@worthless.info> - 2011-06-16 20:36 -0400
Re: Form fields to database and back? The Natural Philosopher <tnp@invalid.invalid> - 2011-06-17 01:43 +0100
Re: Form fields to database and back? Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-16 21:03 -0400
Re: Form fields to database and back? Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-16 21:02 -0400
Re: Form fields to database and back? bobmct <bobm3@worthless.info> - 2011-06-16 22:34 -0400
Re: Form fields to database and back? Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-16 23:50 -0400
Re: Form fields to database and back? bobmct <bobm3@worthless.info> - 2011-06-17 07:09 -0400
Re: Form fields to database and back? bobm3@worthless.info - 2011-06-17 15:18 +0000
Re: Form fields to database and back? Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-17 16:44 -0400
Re: Form fields to database and back? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-06-17 13:28 +0200
Re: Form fields to database and back? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-06-17 22:03 +0200
Re: Form fields to database and back? bobmct <bobm3@worthless.info> - 2011-06-17 19:52 -0400
Re: Form fields to database and back? Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-17 21:01 -0400
Re: Form fields to database and back? Captain Paralytic <paul_lautman@yahoo.com> - 2011-06-22 09:05 -0700
Re: Form fields to database and back? Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-22 13:15 -0400
Re: Form fields to database and back? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-06-18 08:35 +0200
csiph-web