|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Thu May 31 2007 - 04:50:09 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 31 May 2007 09:50:09 -0000 Issue 4821
Topics (messages 255870 through 255897):
Re: preg_match() returns false but no documentation why
255870 by: Richard Lynch
255877 by: Jared Farrish
255881 by: Jim Lucas
255883 by: Jared Farrish
255885 by: Paul Novitski
255886 by: Jared Farrish
255887 by: Paul Novitski
255888 by: Jared Farrish
255893 by: Paul Novitski
255895 by: Crayon Shin Chan
Re: find (matching) person in other table
255871 by: Jared Farrish
255873 by: Richard Lynch
255874 by: Afan Pasalic
255876 by: Afan Pasalic
255879 by: Jared Farrish
255882 by: Afan Pasalic
255884 by: Jared Farrish
255896 by: info.phpyellow.com
Re: ini_set() security question
255872 by: Richard Lynch
Re: OOB problem, super stumped.
255875 by: Brian Seymour
255880 by: Jim Lucas
Re: exec dont work for svn
255878 by: Manolet Gmail
Re: using mysql_escape_string with implode() !!
255889 by: Greg Donald
255892 by: Jim Lucas
255894 by: Greg Donald
Re: Streaming download to IE doesn't work
255890 by: Daniel Kasak
255891 by: Daniel Kasak
local v remote
255897 by: blueboy
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On Wed, May 30, 2007 3:25 pm, Jared Farrish wrote:
> On 5/30/07, Stut <stuttle
gmail.com> wrote:
>>
>> You need delimiters around the regex, as stated in the
>> documentation.
>>
>> preg_match("/^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/",$this->server)
>>
>> Although you don't need to use slashes, you can use any character
>> you
>> want but you must escape it in if it appears in the regex.
>
>
> Oh! You know, I had looked over those a couple times already. Can't
> say why
> I didn't see them.
>
> It will return false on an error, such as not having matching
> delimiters
>> aroung the regex.
>>
>> The error function may retuyrn 0, but which of the following
>> constants
>> is defined as 0?
>>
>> PREG_NO_ERROR
>> PREG_INTERNAL_ERROR
>> PREG_BACKTRACK_LIMIT_ERROR
>> PREG_RECURSION_LIMIT_ERROR
>> PREG_BAD_UTF8_ERROR
>
>
> I don't know, I'm assuming it means no error... I couldn't see
> anywhere
> where it mentioned what was what.
If you can't find them documented, print them out:
echo "PREG_NO_ERROR: '", PREG_NO_ERROR, '";
Or even:
var_dump(PREG_NO_ERROR);
> Now that I'm looking at it again, I see it's 5.2 or greater, and I
> think
> we're on 5.1 or something. Although, it seems like it would have a
> fatal
> error if I call a function that doesn't exist...
The function exists.
The constants may not...
>> Use === to distinguish FALSE from 0, which are not the same.
>
> I realize they're not the same. What I was saying was that "false" is
> not
> the stated return value if it's not found. If it's not printing a
> zero,
> shouldn't that mean it's returning false?
>
> preg_match("/^ldap(s)?:\/\/([a-zA-Z0-9-])+\.[a-zA-Z.]{2,5}$/",$this->server)
Try using | instead of / for your delimiter, so that you don't have to
dink around with escaping the / in the pattern...
Makes the code less cluttered and more clear.
Unless you have | in your pattern, or need the Regex branch '|'
character.
> Now when I add the slashes, I get zero, even though I give it a real
> value
> that should return 1. *sigh*
You may want \\. for the . in dot com
Download and play with "The Regex Coach"
It does pretty color syntax highlighting of the target string and your
regex to show you what's going on, as well as a slow-motion instant
replay to "step" through it piece by piece.
Doesn't always match PHP perfectly, as it's for Perl, but, man, that
tool alone has saved me a few hundred hours.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On 5/30/07, Richard Lynch <ceo
l-i-e.com> wrote:
>
> If you can't find them documented, print them out:
>
> echo "PREG_NO_ERROR: '", PREG_NO_ERROR, '";
>
Doh!
PREG_NO_ERROR: 0
PREG_INTERNAL_ERROR: 1
PREG_BACKTRACK_LIMIT_ERROR: 2
PREG_RECURSION_LIMIT_ERROR: 3
PREG_BAD_UTF8_ERROR: 4
So apparently, "PREG_NO_ERROR" is synonymous for "you need delimiters,
egghead."
>
> preg_match("/^ldap(s)?:\/\/([a-zA-Z0-9-])+\.[a-zA-Z.]{2,5}$/",$this->server)
>
> Try using | instead of / for your delimiter, so that you don't have to
> dink around with escaping the / in the pattern...
You only have to escape "/" if it's part if it's the pattern delimiter?
Makes the code less cluttered and more clear.
Fo' sho'.
> > Now when I add the slashes, I get zero, even though I give it a real
> > value
> > that should return 1. *sigh*
>
> You may want \\. for the . in dot com
Ok, I tried:
preg_match("|^ldap(s)?://([a-zA-Z0-9-])+\.[a-zA-Z.]{2,5}$|",$this->server)
preg_match("|^ldap(s)?://([a-zA-Z0-9-])+\\.[a-zA-Z.]{2,5}$|",$this->server)
preg_match("|^ldap(s)?:\/\/([a-zA-Z0-9-])+\\.[a-zA-Z.]{2,5}$|",$this->server)
using: $this->server = "ldap://www.example.com";
No luck. I'll the try tool you referred to; I have been using
regular-expressions.info for information.
Download and play with "The Regex Coach"
>
> It does pretty color syntax highlighting of the target string and your
> regex to show you what's going on, as well as a slow-motion instant
> replay to "step" through it piece by piece.
Oooh, pretty colors! Stepping through sounds interesting. I'll have to check
it out.
Thanks!
--
Jared Farrish
Intermediate Web Developer
Denton, Tx
Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$
attached mail follows:
Stut wrote:
> Jared Farrish wrote:
>> On 5/30/07, Richard Lynch <ceo
l-i-e.com> wrote:
>>> On Wed, May 30, 2007 12:33 pm, Jared Farrish wrote:
>>> >
>>> > preg_match("^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$",$this->server)
>>>
>>> You are missing the start/end delimiters is your first problem...
>>
>> Which ones? I've got the starter "^" and the closer "$", so what else
>> am I
>> missing?
>
> You need delimiters around the regex, as stated in the documentation.
>
> preg_match("/^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/",$this->server)
This isn't going to work, the op has two forward slashes in the string that he is wanting to match with.
The op will need to use something other than forward slashes.
so, this is going to match:
ldap://testing123.com TRUE
ldap://www.testing-123.com FALSE
ldap://testing123.com.uk FALSE
ldap://testing123.or.us TRUE
preg_match('|^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$|', $this->server )
I also recommend using single quotes instead of double quotes here.
btw: why is there a period in the second pattern? Also, why are you allowing for uppercase letters
when the RFC's don't allow them?
Just my thoughts
>
> Although you don't need to use slashes, you can use any character you
> want but you must escape it in if it appears in the regex.
>
>>> would a regex operation return false?
>>>
>>> It would return false if your string doesn't match the expression.
>>>
>>
>> The manual claims it will return a 0 signaling "0 matches found." And
>> then,
>> under "Return Values," it's says very quickly:
>>
>> "*preg_match()* returns *FALSE* if an error occurred."
>>
>> If it's not returning ANYTHING I'm assuming it's faulting, but the
>> calling
>> the error function returns 0 (kind've ironic, really...).
>
> It will return false on an error, such as not having matching delimiters
> aroung the regex.
>
> The error function may retuyrn 0, but which of the following constants
> is defined as 0?
>
> PREG_NO_ERROR
> PREG_INTERNAL_ERROR
> PREG_BACKTRACK_LIMIT_ERROR
> PREG_RECURSION_LIMIT_ERROR
> PREG_BAD_UTF8_ERROR
>
> -Stut
>
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Unknown
attached mail follows:
On 5/30/07, Jim Lucas <lists
cmsws.com> wrote:
> The op will need to use something other than forward slashes.
You mean the delimiters (a la Richard's suggestion about using '|')?
so, this is going to match:
> ldap://testing123.com TRUE
> ldap://www.testing-123.com FALSE
> ldap://testing123.com.uk FALSE
> ldap://testing123.or.us TRUE
Hmm. What makes them fail/not fail? The '//' in the pattern?
preg_match('|^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$|', $this->server )
>
> I also recommend using single quotes instead of double quotes here.
Single Quotes: Noted. Any reason why? I guess you might be a little out of
luck putting $vars into a regex without . concatenating.
> why is there a period in the second pattern?
The period comes from the original article on SitePoint (linked earlier). Is
it unnecessary? I can't say I'm real sure what this means for the '.' in
regex's:
"Matches any single character except line break characters \r and \n. Most
regex flavors have an option to make the dot match line break characters
too."
- http://www.regular-expressions.info/reference.html
> Also, why are you allowing for uppercase letters
> when the RFC's don't allow them?
I hadn't gotten far enough to strtolower(), but that's a good point, I
hadn't actually considered it yet.
Just my thoughts
Hey, I appreciate it!
--
Jared Farrish
Intermediate Web Developer
Denton, Tx
Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$
attached mail follows:
>On 5/30/07, Jim Lucas <lists
cmsws.com> wrote:
>
>>The op will need to use something other than forward slashes.
At 5/30/2007 03:26 PM, Jared Farrish wrote:
>You mean the delimiters (a la Richard's suggestion about using '|')?
Hi Jared,
If the pattern delimiter character appears in the pattern it must be
escaped so that the regexp processor will correctly interpret it as a
pattern character and not as the end of the pattern.
This would produce a regexp error:
/ldap://*/
but this is OK:
/ldap:\/\/*/
Therefore if you choose another delimiter altogether you don't have
to escape the slashes:
#ldap://*#
Cleaner and more clear.
>preg_match('|^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$|', $this->server )
>>
>>I also recommend using single quotes instead of double quotes here.
>
>Single Quotes: Noted. Any reason why? I guess you might be a little out of
>luck putting $vars into a regex without . concatenating.
Both PHP and regexp use the backslash as an escape. Inside double
quotes, PHP interprets \ as escape, while inside single quotes PHP
interprets \ as a simple backslash character.
When working with regexp in PHP you're dealing with two interpreters,
first PHP and then regexp. To support PHP's interpretation with
double quotes, you have to escape the escapes:
Single quotes: '/ldap:\/\/*/'
Double quotes: "/ldap:\\/\\/*/"
PHP interprets "\\/" as \/
RegExp interprets \/ as /
There's also the additional minor argument that single-quoted strings
take less processing because PHP isn't scanning them for escaped
characters and variables to expand. On a practical level, though,
the difference is going to be measured in microseconds and is
unlikely to affect the perceptible speed of a typical PHP application.
So, for a pattern like this that contains slashes, it's best to use a
non-slash delimiter AND single quotes (unless, as you say, you need
to include PHP variables in the pattern):
$pattern = '#ldap://*#';
Personally I favor heredoc syntax for such situations because I don't
have to worry about the quotes:
$regexp = <<<_
#ldap://*$var#
_;
>>why is there a period in the second pattern?
>
>The period comes from the original article on SitePoint (linked earlier). Is
>it unnecessary? I can't say I'm real sure what this means for the '.' in
>regex's:
>
>"Matches any single character except line break characters \r and \n. Most
>regex flavors have an option to make the dot match line break characters
>too."
>- http://www.regular-expressions.info/reference.html
Inside of a bracketed character class, the dot means a literal period
character and not a wildcard.
"All non-alphanumeric characters other than \, -, ^ (at the start)
and the terminating ] are non-special in character classes"
PHP PREG
Pattern Syntax
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
scroll down to 'Square brackets'
>>Also, why are you allowing for uppercase letters
>>when the RFC's don't allow them?
>
>I hadn't gotten far enough to strtolower(), but that's a good point, I
>hadn't actually considered it yet.
Perhaps it has to do with the source of the string: can you guarantee
that the URIs passed to this routine conform to spec?
Another way to handle this would be to simply accept case-insensitive strings:
|^ldap(s)?://[a-z0-9-]+\.[a-z.]{2,5}$|i
Pattern Modifiers
http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
"i (PCRE_CASELESS)
" If this modifier is set, letters in the pattern match both upper
and lower case letters."
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
attached mail follows:
> If the pattern delimiter character appears in the pattern it must be
> escaped so that the regexp processor will correctly interpret it as a
> pattern character and not as the end of the pattern.
>
> This would produce a regexp error:
>
> /ldap://*/
>
> but this is OK:
>
> /ldap:\/\/*/
>
> Therefore if you choose another delimiter altogether you don't have
> to escape the slashes:
>
> #ldap://*#
>
> Cleaner and more clear.
Ok, that makes sense.
> >preg_match('|^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$|', $this->server
)
> >>
> >>I also recommend using single quotes instead of double quotes here.
> >
> >Single Quotes: Noted. Any reason why? I guess you might be a little out
of
> >luck putting $vars into a regex without . concatenating.
>
> Both PHP and regexp use the backslash as an escape. Inside double
> quotes, PHP interprets \ as escape, while inside single quotes PHP
> interprets \ as a simple backslash character.
>
> When working with regexp in PHP you're dealing with two interpreters,
> first PHP and then regexp. To support PHP's interpretation with
> double quotes, you have to escape the escapes:
>
> Single quotes: '/ldap:\/\/*/'
> Double quotes: "/ldap:\\/\\/*/"
>
> PHP interprets "\\/" as \/
> RegExp interprets \/ as /
Oh. Duh! I wasn't even considering PHP parsing the string due to the double
quoted string.
> So, for a pattern like this that contains slashes, it's best to use a
> non-slash delimiter AND single quotes (unless, as you say, you need
> to include PHP variables in the pattern):
>
> $pattern = '#ldap://*#';
>
> Personally I favor heredoc syntax for such situations because I don't
> have to worry about the quotes:
>
> $regexp = <<<_
> #ldap://*$var#
> _;
Yeah, I just wish there were some way heredoc could work on one line.
> >>why is there a period in the second pattern?
> >
> >The period comes from the original article on SitePoint (linked earlier).
Is
> >it unnecessary? I can't say I'm real sure what this means for the '.' in
> >regex's:
> >
> >"Matches any single character except line break characters \r and \n.
Most
> >regex flavors have an option to make the dot match line break characters
> >too."
> >- http://www.regular-expressions.info/reference.html
>
> Inside of a bracketed character class, the dot means a literal period
> character and not a wildcard.
>
> "All non-alphanumeric characters other than \, -, ^ (at the start)
> and the terminating ] are non-special in character classes"
So what does the definition I posted mean for non-bracketed periods? Does it
mean it will match anything but a line or return break character? How in
practice is this useful?
> PHP PREG
> Pattern Syntax
> http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
> scroll down to 'Square brackets'
>
>
> >>Also, why are you allowing for uppercase letters
> >>when the RFC's don't allow them?
> >
> >I hadn't gotten far enough to strtolower(), but that's a good point, I
> >hadn't actually considered it yet.
>
> Perhaps it has to do with the source of the string: can you guarantee
> that the URIs passed to this routine conform to spec?
I just prefer to use strtolower(). I have to use the server address
anyways...
Breaking News: I had a thought (surprise!). Are LDAP servers ever on
localhost? Or at least a non-dot-concatenated address
(ldap://directoryname)? The pattern we've been looking won't match that, I
think.
> Another way to handle this would be to simply accept case-insensitive
strings:
>
> |^ldap(s)?://[a-z0-9-]+\.[a-z.]{2,5}$|i
I actually read about that a little while ago, I just didn't know where to
put the i. Thanks!
> Pattern Modifiers
> http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
>
> "i (PCRE_CASELESS)
> " If this modifier is set, letters in the pattern match both upper
> and lower case letters."
How do you test regex's against any known variants? I suppose I need to
build a test function to make arbitrary strings and then test and print the
results. I just don't know if my regex is going to be that great in
practice.
This would be in addition to the program Richard alluded to in the code
checker.
Thanks!
--
Jared Farrish
Intermediate Web Developer
Denton, Tx
Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$
attached mail follows:
At 5/30/2007 05:08 PM, Jared Farrish wrote:
>So what does the definition I posted mean for non-bracketed periods? Does it
>mean it will match anything but a line or return break character? How in
>practice is this useful?
Read the manual:
Pattern Syntax
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
. match any character except newline (by default)
...
Full stop
Outside a character class, a dot in the pattern matches any one
character in the subject, including a non-printing character, but not
(by default) newline. If the PCRE_DOTALL option is set, then dots
match newlines as well. The handling of dot is entirely independent
of the handling of circumflex and dollar, the only relationship being
that they both involve newline characters. Dot has no special meaning
in a character class.
etc.
>How do you test regex's against any known variants? I suppose I need to
>build a test function to make arbitrary strings and then test and print the
>results. I just don't know if my regex is going to be that great in
>practice.
rework - an online regular expression workbench
by Oliver Steele
http://osteele.com/tools/rework/
The RegEx Coach (a downloadable Windows application)
by Edi Weitz
http://weitz.de/regex-coach/
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
attached mail follows:
> Read the manual:
All due respect, I did read it. It's just... a little dense and not
practically descriptive.
Maybe it's more practical to ask, "When is it practical to use it?"
It matches anything, so I assume that means you can use it to match, say, a
paragraph that you can't predict or match against? One that you're looking
for a pattern match on one or either end?
I just look at the definition and have a hard time fitting it in. I'm
looking at some examples, though, so I'm sure I'll get it.
And why is it called full stop? Ok, maybe the definition doesn't make any
kind of sense to me, ie, practical usage.
Does it mean match anything that, say, *starts* with a pattern but ends with
"whatever" (.)???
Thanks!
--
Jared Farrish
Intermediate Web Developer
Denton, Tx
Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$
attached mail follows:
Hi Jared,
At 5/30/2007 06:00 PM, Jared Farrish wrote:
>>Read the manual:
>
>All due respect, I did read it. It's just... a little dense and not
>practically descriptive.
Sorry, I didn't mean to be disrespectful, I thought your question was
more elementary than it was. There are, though, a ton of regular
expression resources on the net. Google Is Your Friend. I just got
a million hits on 'regular expression tutorial.'
>Maybe it's more practical to ask, "When is it practical to use it?"
>
>It matches anything, so I assume that means you can use it to match, say, a
>paragraph that you can't predict or match against? One that you're looking
>for a pattern match on one or either end?
Well, sure. It often appears as .* meaning "none or any number of
any characters." Use it when you honestly don't care what it matches.
Say you want to find out if the word "frog" occus in a text followed
by the word "dog." You could match on:
/\bfrog\b(.*\b)?dog\b/i
/ pattern delimiter
\b word boundary
frog 1st word
\b word boundary
( begin subpattern
.* zero or any characters
\b word boundary
) end subpattern
? zero or one instance of the preceding subpattern
dog 2nd word
\b word boundary
/ pattern delimiter
i case-insensitive
This guarantees that both words are bounded by word boundaries and
allows any number of any characters to occur between them. (There's
sort of an implicit .* before and after the pattern. Because I
haven't used ^ and $ to define the beginning and end of the text,
regex looks for my pattern anywhere in the text.)
>And why is it called full stop?
That's what the 'period' is called in British English.
http://google.ca/search?q=define%3Afull+stop
In English syntax "period" and "full stop" are synonymous, and the
RegEx manual is throwing "dot" into the same bag.
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
attached mail follows:
On Thursday 31 May 2007 01:33, Jared Farrish wrote:
> Can anybody spot why this doesn't seem to be working right? The manual
> ( http://us2.php.net/preg_match) says it returns "false" on error, but
> preg_last_error() returns 0, which I assume points to the
> "PREG_NO_ERROR" error code.
>
> <code>
> preg_match("^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$",$this->server)
> </code>
>
> I also tried ereg(), and have searched and gone through the comments.
> Why would a regex operation return false?
If you check your error log you'll find:
Warning: preg_match(): No ending delimiter '^' found in xxx.php on line xx
IMO that shouldn't be a warning, it should be an error that halts
execution so people wouldn't go looking for a non-existant
preg_last_error() when preg_match() did not even run.
--
Crayon
attached mail follows:
On 5/30/07, Jared Farrish <farrishj
gmail.com> wrote:
>
> $lastname = strpos('Rogers',0,2);
> $firstname = strpos('Timothy',0,2);
> $select = "SELECT `uid`,`LastName`,`FirstName`
> FROM `users`
> WHERE LastName='$lastname%'
> AND FirstName='$firstname%'";
>
Strike the above and make it:
$lastname = substr('Rogers',0,3);
$firstname = substr('Timothy',0,3);
$select = "SELECT `uid`,`LastName`,`FirstName`
FROM `users`
WHERE LastName='$lastname%'
AND FirstName='$firstname%'";
Foolisness!
--
Jared Farrish
Intermediate Web Developer
Denton, Tx
Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$
attached mail follows:
On Wed, May 30, 2007 3:30 pm, Afan Pasalic wrote:
> hi,
> the code I'm working on has to compare entered info from registration
> form with data in members table and list to administrator (my client)
> all "matching" people. admin then has to decide is person who
> registered
> already in database and assign his/her member_id or the registered
> person is new one and assign new member_id.
>
> I was thinking to assign points (percentage) to matching fields (last
> name, first name, email, phone, city, zip, phone) and then list people
> with more than 50%. e.g., if first and last name match - 75%, if only
> email match - 85%, if first name, last name and email match - 100%, if
> last name and phone match - 50%... etc.
>
> does anybody have any experience with such a problem? or something
> similar?
I've played this game several times.
You generally have to have a human override, because it will never be
perfect, no mater how much you tweak it -- I mean, let the admin also
just "search" for whatever they want to match up the new registration
with the old person.
You may have only the first name matching on somebody who got married
and moved that won't score well...
But you'll have 10 John Smith's in there.
You can do it fairly easily building the query dynamically:
<?php
//find possible duplicates/existing members:
$query = "select member_id, name, address, phone, etc ";
//all members get 0 points to start:
$query .= " 0 ";
//add 5 points for last name matching:
$query .= " + 5 * (last_name = '$last_name') ";
//add 1 point for first name matching:
$query .= " + (first_name = '$first_name') ";
//and so on
$query .= " as score ";
$query .= " from member ";
//maybe this has to be: HAVING score > 0
$query .= " where score > 0 ";
?>
You can play all kinds of games with the numbers and weighting various
bits of data -- but complicating it too much beyond the obvious
natural choice rarely improves the success rate very much...
A simple checkbox on the form:
Are you already a member: ____
will help provide an invaluable cross-check as to whether there SHOULD
be a member record....
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Jared Farrish wrote:
>> I was thinking to assign points (percentage) to matching fields (last
>> name, first name, email, phone, city, zip, phone) and then list people
>> with more than 50%. e.g., if first and last name match - 75%, if only
>> email match - 85%, if first name, last name and email match - 100%, if
>> last name and phone match - 50%... etc.
>>
>> does anybody have any experience with such a problem? or something
> similar?
>
> Although you should be able to do this with you SELECT (I guess, never
> have), since you posted this to a PHP mailing, you get a PHP answer!
>
> Look up Levinshtein in the php manual and start from there:
>
> http://us2.php.net/manual/en/function.levenshtein.php
>
> If you can do this on SELECT (using the db engine), I would suggest
> that, as
> that way you don't have to return a giant list to poke through.
>
> You can also use wildcards, and only select matches that have the first
> three characters:
>
> $lastname = strpos('Rogers',0,2);
> $firstname = strpos('Timothy',0,2);
> $select = "SELECT `uid`,`LastName`,`FirstName`
> FROM `users`
> WHERE LastName='$lastname%'
> AND FirstName='$firstname%'";
>
> I haven't tested that, but I think it would work. You would need to
> work on
> a way to LIMIT the matches effectively. If that doesn't work, hey,
> this is a
> PHP list...
yes. in one hand it's more for mysql list. though, I was thinking more
if somebody had already something similar as a "project". more as path I
have to follow.
e.g., in your example, in where clause AND doesn't work because bob
could be robert too, right? and last name has to match 100%, right? (or
I'm wrong?)
how "smart" solution will be something like this:
$query = my_query("select id from members where last_name='$last_name'");
while($result = mysql_fetch_array($query))
{
$MEMBERS[$result['id']] += 50;
}
$query = my_query("select id from members where first_name='$first_name'");
while($result = mysql_fetch_array($query))
{
$MEMBERS[$result['id']] += 10;
}
$query = my_query("select id from members where email='$email'");
while($result = mysql_fetch_array($query))
{
$MEMBERS[$result['id']] += 85;
}
etc.
after last query I will have an array of people. and I'll list all
person with "score" more than 50.
or, since last name MUST match, I think it's better this way (just got
in my head):
$query = my_query("select id from members where last_name='$last_name'");
while($result = mysql_fetch_array($query))
{
$query = my_query("select id from members where
first_name='$first_name'");
while($result = mysql_fetch_array($query))
{
$MEMBERS[$result['id']] += 10;
}
$query = my_query("select id from members where email='$email'");
while($result = mysql_fetch_array($query))
{
$MEMBERS[$result['id']] += 85;
}
etc.
}
attached mail follows:
Richard Lynch wrote:
> On Wed, May 30, 2007 3:30 pm, Afan Pasalic wrote:
>
>> hi,
>> the code I'm working on has to compare entered info from registration
>> form with data in members table and list to administrator (my client)
>> all "matching" people. admin then has to decide is person who
>> registered
>> already in database and assign his/her member_id or the registered
>> person is new one and assign new member_id.
>>
>> I was thinking to assign points (percentage) to matching fields (last
>> name, first name, email, phone, city, zip, phone) and then list people
>> with more than 50%. e.g., if first and last name match - 75%, if only
>> email match - 85%, if first name, last name and email match - 100%, if
>> last name and phone match - 50%... etc.
>>
>> does anybody have any experience with such a problem? or something
>> similar?
>>
>
> I've played this game several times.
>
> You generally have to have a human override, because it will never be
> perfect, no mater how much you tweak it -- I mean, let the admin also
> just "search" for whatever they want to match up the new registration
> with the old person.
>
yes. that's the plan. to show all "matching" people and admin will then
decide who is REALLY the match (if any).
> You may have only the first name matching on somebody who got married
> and moved that won't score well...
>
right. I forgot about this possibility :-(
> But you'll have 10 John Smith's in there.
>
> You can do it fairly easily building the query dynamically:
>
> <?php
> //find possible duplicates/existing members:
> $query = "select member_id, name, address, phone, etc ";
> //all members get 0 points to start:
> $query .= " 0 ";
> //add 5 points for last name matching:
> $query .= " + 5 * (last_name = '$last_name') ";
> //add 1 point for first name matching:
> $query .= " + (first_name = '$first_name') ";
> //and so on
> $query .= " as score ";
> $query .= " from member ";
> //maybe this has to be: HAVING score > 0
> $query .= " where score > 0 ";
> ?>
>
> You can play all kinds of games with the numbers and weighting various
> bits of data -- but complicating it too much beyond the obvious
> natural choice rarely improves the success rate very much...
>
> A simple checkbox on the form:
> Are you already a member: ____
> will help provide an invaluable cross-check as to whether there SHOULD
> be a member record....
>
good point too!
;-)
thanks.
-afan
attached mail follows:
On 5/30/07, Afan Pasalic <afan
afan.net> wrote:
>
> yes. in one hand it's more for mysql list. though, I was thinking more
> if somebody had already something similar as a "project". more as path I
> have to follow.
> e.g., in your example, in where clause AND doesn't work because bob
> could be robert too, right? and last name has to match 100%, right? (or
> I'm wrong?)
You're right. Remember, that was an example of what you MIGHT do, not
necessarily what you SHOULD do.
You could also situationally check the returned fields and if it's greater
than, say, 25 or 50, re-run the query and change the letters matched to 4,
for instance, and then add a link to get the greater total.
You could also look at the "search box suggestion" code that's out there for
a way to implement this on the server side. Don't know if that code will be
optimized or not, but that's essentially what you're doing here.
how "smart" solution will be something like this:
>
> $query = my_query("select id from members where last_name='$last_name'");
> while($result = mysql_fetch_array($query))
> {
> $MEMBERS[$result['id']] += 50;
> }
Well, see, if the match isn't exact, it won't return anything. Unless you
know the exact name.
You also may have to deal with someone misstyping their name(s).
$query = my_query("select id from members where first_name='$first_name'");
> while($result = mysql_fetch_array($query))
> {
> $MEMBERS[$result['id']] += 10;
> }
>
> $query = my_query("select id from members where email='$email'");
> while($result = mysql_fetch_array($query))
> {
> $MEMBERS[$result['id']] += 85;
> }
Why would you do that many SELECTs? (Also, if you cap the SQL commands, it's
easier to read.)
etc.
>
> after last query I will have an array of people. and I'll list all
> person with "score" more than 50.
This is a really roundabout way to do this. Look at the Levinshtein PHP
manual page for some suggestions on how to calculate similarities. I *think*
that should be better to do this:
for ($i = 0; $i < count($mysqlresultset); $i++) {
$lev = levenshtein($mysqlresultset[$i][$firstname], $postedname);
if ($lev > 49) {
$matches[] = $mysqlresultset[$i];
}
}
or, since last name MUST match, I think it's better this way (just got
> in my head):
> $query = my_query("select id from members where last_name='$last_name'");
> while($result = mysql_fetch_array($query))
> {
> $query = my_query("select id from members where
> first_name='$first_name'");
> while($result = mysql_fetch_array($query))
> {
> $MEMBERS[$result['id']] += 10;
> }
>
> $query = my_query("select id from members where email='$email'");
> while($result = mysql_fetch_array($query))
> {
> $MEMBERS[$result['id']] += 85;
> }
>
> etc.
> }
There's a lot of unnecessary work you're making PHP and your database do.
This is quite inefficient code.
If you're trying to match the emails and whatnot, then combine all those
queries together. SELECT them all together. It looks like what you're doing
is weighting it by email address, which you can add to the SELECT I posted
(although you need to think about how you use your wildcards for email
addresses, such as maybe matching the beginning OR the end, for instance).
It's even better if the person has to activate the account with an email
link to activate, since then you'd know the email address existed (although
it doesn't mean it isn't someone in the database that isn't already in
there).
--
Jared Farrish
Intermediate Web Developer
Denton, Tx
Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$
attached mail follows:
Jared Farrish wrote:
> On 5/30/07, Afan Pasalic <afan
afan.net> wrote:
>>
>> yes. in one hand it's more for mysql list. though, I was thinking more
>> if somebody had already something similar as a "project". more as path I
>> have to follow.
>> e.g., in your example, in where clause AND doesn't work because bob
>> could be robert too, right? and last name has to match 100%, right? (or
>> I'm wrong?)
>
>
> You're right. Remember, that was an example of what you MIGHT do, not
> necessarily what you SHOULD do.
sure. I just want to be sure you understand what I was thinking (because
of my english :-) )
> You could also situationally check the returned fields and if it's
> greater
> than, say, 25 or 50, re-run the query and change the letters matched
> to 4,
> for instance, and then add a link to get the greater total.
>
> You could also look at the "search box suggestion" code that's out
> there for
> a way to implement this on the server side. Don't know if that code
> will be
> optimized or not, but that's essentially what you're doing here.
>
> how "smart" solution will be something like this:
>>
>> $query = my_query("select id from members where
>> last_name='$last_name'");
>> while($result = mysql_fetch_array($query))
>> {
>> $MEMBERS[$result['id']] += 50;
>> }
>
>
> Well, see, if the match isn't exact, it won't return anything. Unless you
> know the exact name.
>
> You also may have to deal with someone misstyping their name(s).
>
> $query = my_query("select id from members where
> first_name='$first_name'");
>> while($result = mysql_fetch_array($query))
>> {
>> $MEMBERS[$result['id']] += 10;
>> }
>>
>> $query = my_query("select id from members where email='$email'");
>> while($result = mysql_fetch_array($query))
>> {
>> $MEMBERS[$result['id']] += 85;
>> }
>
>
> Why would you do that many SELECTs? (Also, if you cap the SQL
> commands, it's
> easier to read.)
"most likely" because I was thinking that it shouldn't be big deal. but
after your and richard's email - definitely have to try to make it as
one query.
> etc.
>>
>> after last query I will have an array of people. and I'll list all
>> person with "score" more than 50.
>
>
> This is a really roundabout way to do this. Look at the Levinshtein PHP
> manual page for some suggestions on how to calculate similarities. I
> *think*
> that should be better to do this:
>
> for ($i = 0; $i < count($mysqlresultset); $i++) {
> $lev = levenshtein($mysqlresultset[$i][$firstname], $postedname);
> if ($lev > 49) {
> $matches[] = $mysqlresultset[$i];
> }
> }
>
I'm just studying it. :-)
> or, since last name MUST match, I think it's better this way (just got
>> in my head):
>> $query = my_query("select id from members where
>> last_name='$last_name'");
>> while($result = mysql_fetch_array($query))
>> {
>> $query = my_query("select id from members where
>> first_name='$first_name'");
>> while($result = mysql_fetch_array($query))
>> {
>> $MEMBERS[$result['id']] += 10;
>> }
>>
>> $query = my_query("select id from members where email='$email'");
>> while($result = mysql_fetch_array($query))
>> {
>> $MEMBERS[$result['id']] += 85;
>> }
>>
>> etc.
>> }
>
>
> There's a lot of unnecessary work you're making PHP and your database do.
> This is quite inefficient code.
that's why I ask here - to learn. and I appreciate for any help.
> If you're trying to match the emails and whatnot, then combine all those
> queries together. SELECT them all together. It looks like what you're
> doing
> is weighting it by email address, which you can add to the SELECT I
> posted
> (although you need to think about how you use your wildcards for email
> addresses, such as maybe matching the beginning OR the end, for
> instance).
> It's even better if the person has to activate the account with an email
> link to activate, since then you'd know the email address existed
> (although
> it doesn't mean it isn't someone in the database that isn't already in
> there).
email has to match "in total". sales
abc-comp.com and info
abc-comp.com
are NOT the same in my case.
thanks jared,
-afan
attached mail follows:
On 5/30/07, Afan Pasalic <afan
afan.net> wrote:
email has to match "in total". sales
abc-comp.com and info
abc-comp.com
> are NOT the same in my case.
>
> thanks jared,
If you can match a person by their email, why not just SELECT by email only
(and return the persons information)?
Consider, as well, that each time you're calling a database, you're slowing
down the response of the page. So, while making a bunch of small calls might
not seem like that much, consider:
||||||| x |||||||
||||||| a |||||||
||||||| b |||||||
Versus
||||||| x, a, b |||||||
The letters represent the request/response data (what you're giving to get,
then get back), and the pipes (|) are the overhead to process, send, receive
(on DB), process (on DB), send (on DB), receive, process, return to code.
The overhead and latency used to complete one request makes it a quicker,
less "heavy" operation. If you did the first a couple hundred or thousand
times, I would bet your page would drag to a halt while it loads...
--
Jared Farrish
Intermediate Web Developer
Denton, Tx
Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$
attached mail follows:
Hello Afan & list,
I recently coded such an animal for a customer. It is a quick and dirty piece of work. They had an existing dataset and wanted to match new registrants against the dataset so as to avoid duplication. First we applied logic to not accept duplicate email addresses in the registration, and sent the potential duplicate user off to the password lookup page. Next we assigned a contact_type, usertype, and sales_status:
contact_type enum( "company", "individual") default "company";
usertype enum( "primary", "secondary", "other") default "primary";
sales_status enum( "open", "hide") default "open";
Explanation
Customer is using data for contact management and sales.
sales_status lets the admin toggle off visibility, so as to hide records they don't want to see
usertype lets multiple users exist from the same company - we can track everyone in their organization :), but only one is the primary contact
Match script
So next the match script was built which allows the admin to surf thru the dataset, and lookup any string. Of the data fields these were found to be significant for us:
username, email, companyname
So the Find Match script lets you click on any of username, email, companyname and pulls out LIKE "$username%" or LIKE "$email%" (but just the domain part) OR LIKE "$companyname%" examples, depending on what you selected. This yields a match in the last part, but not the first, of the selected match variable. I did not apply a percentage result such as you suggest. Matches can and are found in almost every data field. The trained human eye works better than a percentage, always will. Anyway, because the script result returns ONE LINE PER RECORD, and this line contains clickable links to match email, match username or match company (and edit record and other stuff), it lets the admin keep surfing thru the database finding matches, or not.
I arbitrarily limited matches to 20 rows, since the user can click on any line to initiate another match of a particular value, its not a biggy to keep searching, in fact, its fun and almost addictive ;)
Lastly I added on basic tools so the admin could change any of the values for any of the data fields. So the tool has a byproduct feature of letting the admin clean up their dataset while they're matching.
The sales person even had his wife doing match lookups for him within the week :)
This I'm sure is not the best or only way, but that's what we did, it works, and the customer is happy. Maybe it will help you too.
Sincerely,
rob
http://phpyellow.com
=======================================
Date: Wed, 30 May 2007 15:30:59 -0500
From: Afan Pasalic <afan
afan.net>
To: php-general <php-general
lists.php.net>
Subject: find (matching) person in other table
hi,
the code I'm working on has to compare entered info from registration
form with data in members table and list to administrator (my client)
all "matching" people. admin then has to decide is person who registered
already in database and assign his/her member_id or the registered
person is new one and assign new member_id.
I was thinking to assign points (percentage) to matching fields (last
name, first name, email, phone, city, zip, phone) and then list people
with more than 50%. e.g., if first and last name match - 75%, if only
email match - 85%, if first name, last name and email match - 100%, if
last name and phone match - 50%... etc.
does anybody have any experience with such a problem? or something similar?
thanks for any help.
-afan
attached mail follows:
On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote:
>> And what happens if you try to allocate 3M of data?
>>
>> $foo = str_repeat('.', 3145728);
>>
> Nothing. It does it without any errors. I can allocate up to 20MB
> (well
> a little bit less of course).
Check http://bugs.php.net and see if it's a known issue or an
exception to the php_admin_* rule or...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Jim,
I put the link identifier back and made your recommended changes and now
everything works perfect. Can't thank you enough.
Is the reason you have to call the parents __construct() method because the
open mysql connection only exists within the scope of the object it was
created in, unless specified otherwise(calling parents constructor)?
Brian Seymour
AeroCoreProductions
http://www.aerocore.net/
-----Original Message-----
From: Jim Lucas [mailto:lists
cmsws.com]
Sent: Wednesday, May 30, 2007 12:02 AM
To: Brian Seymour
Cc: 'php php'
Subject: Re: [PHP] OOB problem, super stumped.
You didn't call the __construct() method of your parent.
The above code, should be like this
public function __construct($host,$user,$pass,$dbname = null) {
parent::__construct($host,$user,$pass,$dbname);
echo "Auth constructed";
}
You were forgetting to call to the parent and have it initialize the DB
connection.
In the second part, the $auth->verifyCreds() call, it didn't create a
valid db connection to pass as the second arg to the mysql_query() call.
And by not passing the $this->conx as the second arg, you are telling it
to "use the most recently opened mysql connection.
Hope this clears up why it was failing on the latter mysql_query() calls.
attached mail follows:
Brian Seymour wrote:
> Jim,
> I put the link identifier back and made your recommended changes and now
> everything works perfect. Can't thank you enough.
>
> Is the reason you have to call the parents __construct() method because the
> open mysql connection only exists within the scope of the object it was
> created in, unless specified otherwise(calling parents constructor)?
no, you are looking at three different scopes here.
One is the mysql_* function in general. The resource $link_identifier is completely optional.
Read the parameters section and link_identifier section
http://us2.php.net/mysql_query
Now, since you are dealing with two different classes, SQL and Authentication, you are deal with yet
another two different scope, one for each class.
SQL, by itself has a scope that contains your original $this->conx property. It only exists within
your object called $database.
Now, the final scope is within the Authentication object $auth. Since Authentication extends the
SQL classes it will inherit a new/different instance of the SQL class/object. Now, since it is a
new copy of the SQL $this->conx does not exists. So, to make the SQL class that is being inherit
have the $this->conx property, you have to call the __construct() method for the parent/SQL class.
Hope I haven't confused you even more.
Ask away if you have any questions.
>
> Brian Seymour
> AeroCoreProductions
> http://www.aerocore.net/
>
> -----Original Message-----
> From: Jim Lucas [mailto:lists
cmsws.com]
> Sent: Wednesday, May 30, 2007 12:02 AM
> To: Brian Seymour
> Cc: 'php php'
> Subject: Re: [PHP] OOB problem, super stumped.
>
> You didn't call the __construct() method of your parent.
>
> The above code, should be like this
>
> public function __construct($host,$user,$pass,$dbname = null) {
> parent::__construct($host,$user,$pass,$dbname);
> echo "Auth constructed";
> }
>
> You were forgetting to call to the parent and have it initialize the DB
> connection.
>
> In the second part, the $auth->verifyCreds() call, it didn't create a
> valid db connection to pass as the second arg to the mysql_query() call.
>
> And by not passing the $this->conx as the second arg, you are telling it
> to "use the most recently opened mysql connection.
>
> Hope this clears up why it was failing on the latter mysql_query() calls.
>
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Unknown
attached mail follows:
2007/5/30, Richard Lynch <ceo
l-i-e.com>:
>
>
> On Tue, May 29, 2007 10:44 am, Manolet Gmail wrote:
> > 2007/5/28, Greg Donald <gdonald
gmail.com>:
> >> On 5/28/07, Manolet Gmail <manolet
gmail.com> wrote:
> >> > but this doesnt work:
> >> >
> >> > exec("svn update",$out);
>
> exec("svn update", $out, $error);
> if ($error) echo "OS Error: $error. Use perror $error in shell to get
> message";
give me error 1:
OS error code 1: Operation not permitted
also, the checkout was did by other user. but i do chmod -R 777 * as root.
so what i can do ?
>
> >> > foreach($out as $line)echo"<br/>$line\n";
> >> >
> >> > dont print anything... dont update the files
> >>
> >> Is it possible you need to provide some type of authentication?
> >> `svn
> >> update` may be asking for input your exec call isn't providing.
> >
> > well, i have error reporting (E ALL) and dont give me any error, also
> > i try with
> >
> > svn update --non-interactive --username user --password pass
> >
> > and again... nothing appears. Also if the svn update ask for a
> > password why php dont show it?, or why i dont receive a maximum
> > ececution time of script error?.
> >
> > the script run instantly btw,..
> >
> >>
> >>
> >> --
> >> Greg Donald
> >> http://destiney.com/
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
>
attached mail follows:
On 5/30/07, Richard Lynch <ceo
l-i-e.com> wrote:
> You want to use mysql_escape_string, and NOT addslashes and NOT Magic
> Quotes.
function slashes( $var )
{
if( is_array( $var ) )
{
return array_map( 'slashes', $var );
}
else
{
return mysql_real_escape_string( $var );
}
}
set_magic_quotes_runtime( 0 );
if( get_magic_quotes_gpc() == 0 )
{
$_GET = isset( $_GET )
? array_map( 'slashes', $_GET )
: array();
$_POST = isset( $_POST )
? array_map( 'slashes', $_POST )
: array();
$_COOKIE = isset( $_COOKIE )
? array_map( 'slashes', $_COOKIE )
: array();
}
--
Greg Donald
http://destiney.com/
attached mail follows:
Greg Donald wrote:
> On 5/30/07, Richard Lynch <ceo
l-i-e.com> wrote:
>> You want to use mysql_escape_string, and NOT addslashes and NOT Magic
>> Quotes.
>
> function slashes( $var )
> {
> if( is_array( $var ) )
> {
> return array_map( 'slashes', $var );
> }
> else
> {
> return mysql_real_escape_string( $var );
> }
> }
Say I wanted to use this on something other than $_GET, $_POST, & $_COOKIE?
Would it not be better practice to do this the other way around?
function slashes ( $var ) {
if ( is_scalar($var) ) {
return mysql_real_escape_string( $var );
} else {
return array_map( 'slashes', $var );
}
}
This way, even if someone passes something that is not an array, but
still not processable by mysql_real_escape_string(), it won't foul up
the processor.
>
> set_magic_quotes_runtime( 0 );
>
> if( get_magic_quotes_gpc() == 0 )
> {
> $_GET = isset( $_GET )
> ? array_map( 'slashes', $_GET )
> : array();
>
> $_POST = isset( $_POST )
> ? array_map( 'slashes', $_POST )
> : array();
>
> $_COOKIE = isset( $_COOKIE )
> ? array_map( 'slashes', $_COOKIE )
> : array();
> }
>
>
attached mail follows:
On 5/30/07, Jim Lucas <lists
cmsws.com> wrote:
> Say I wanted to use this on something other than $_GET, $_POST, & $_COOKIE?
Then I suppose you'll have to compensate with updates to support your
particular usage.
--
Greg Donald
http://destiney.com/
attached mail follows:
On Wed, 2007-05-30 at 13:40 -0500, Richard Lynch wrote:
> On Tue, May 29, 2007 6:37 pm, Daniel Kasak wrote:
> > Actually, that blog had absolutely nothing to do with my problem
> > ( thanks for RTFP!). Not only that, but the recommendation that I
> > construct URLs:
> >
> > http://address.com/script/thing=2/this=3/that=4/download.txt
> >
> > is patently ridiculous.
>
> Why?
It's excessively complex for no actual benefit. It means you have to
have extra code to 'explode' out the various parts of the URL. Even
after reading your description of the code that handles this, it was
non-obvious what it was for. If I returned to this 2 years later ( or
God forbid, someone else had to look at it ), they wouldn't have a clue
what it was doing, or why. But also, as I noted, this 'solution' is to a
different problem - the problem of IE not naming downloads properly. IE
names them properly for me ... it just doesn't download them ( if over
SSL ).
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak
nusconsulting.com.au
website: http://www.nusconsulting.com.au
attached mail follows:
Sorry ... forgot to comment on this ...
On Wed, 2007-05-30 at 13:40 -0500, Richard Lynch wrote:
> > ... in particular, adding:
> >
> > header("Cache-control: private");
> > header("Pragma: public");
> >
> > fixed things perfectly. Also note that things worked perfectly with
> > normal http access from the start; this is required for streaming
> > downloads to IE over *https*
>
> I highly recommend you now re-test your application in every browser,
> every minor version, every release you care about, on every OS
> major.minor you care about.
Yes I realise this. When I originally discovered the problem ( after
developing the app and extensively testing with firefox ), my first
impulse was to get the client to use firefox. The response was that the
app would be used by 2 of *their* clients, and they insist on using IE6.
So based on this, I tested made things work with IE6 and the latest
service packs available via Microsoft Update.
I have absolutely no interest in supporting every single version of
every single browser, at least not for the money I'm being paid, and
especially since I've already been told that the app only needs to
support IE6 ( and it also already supports firefox ).
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak
nusconsulting.com.au
website: http://www.nusconsulting.com.au
attached mail follows:
On my localhost this works fine
$result= mysql_query("SELECT date_format(date, '%d/%m/%Y') as date, title,
id, display FROM NEWS");
while ($row = mysql_fetch_assoc($result)) {
but on my remote i get a mysql_fetch_assoc(): supplied argument is not a
valid MySQL result resource
Can someone expalin the problem? PHP version problem?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]