What that function does is look in a string and find the ascii value of
each character within that string. Depending on the value, it replaces it
with an escaped string. For instance, say you are passing the string
"I love pickles\nThey are good to me\nPickles are made\nFrom cucumbers".
Ignoring the fact that the above sentence is the most random thing I've
written in my life, it will replace all the \n's with \\n so the database
doesn't change it to
"I love pickles
They are good to me
Pickles are made
From cucumbers".
I hope that gives you a better idea. I didn't check through it to find
any syntax errors.
Devon O'Dell
> As I work with this members only file, The submit function is now
> functioning [Thank you Adam] but there is a parsing error on
> > function mysql_escape_string($s)
> when I try to run the file. This is an include and I'm trying to figure
> out if I need it and /or if there might be a simpler work around. The
> script is older so it may not be functioning correctly in php4. It has
> to do with adding info to a database.
>
> <?
>
> if ($g_databasename=="")
> {
>
>
>
>
> function mysql_escape_string($s)
> {
> $sl=strlen($s);
>
> for ($a=0;$a<$sl;$a++)
> {
> $c=substr($s,$a,1);
>
> switch(ord($c))
> {
> case 0:
> $c = "\\0";
> break;
> case 10:
> $c = "\\n";
> break;
> case 9:
> $c = "\\t";
> break;
> case 13:
> $c = "\\r";
> break;
> case 8:
> $c = "\\b";
> break;
> case 39:
> $c = "\\'";
> break;
> case 34:
> $c = "\\\"";
> break;
> case 92:
> $c = "\\\\";
> break;
> case 37:
> $c = "\\%";
> break;
> case 95:
> $c = "\\_";
> break;
> }
>
> $s2.=$c;
> }
>
> return $s2;
> }
>
>
>
> }
>
>
>
>
> ?>
>
> --
> Jefferis Kent Peterson
> www.PetersonSales.net
> Flash, Web Design and Marketing
> ICQ 19112253
> _______
> "Happy is the person who finds wisdom, and the one who gets
> understanding, for the gain from it is better than gain from silver and
> its profit better than gold." - Proverbs 3:13,14.
>