[PHP] Search Agents...

2005-04-28 Thread Nick Zukin
I have a request from a client that has me a little confounded.  He wants to
have a system where when someone posts a public request with certain
criteria, that criteria is then used to find established profiles/agents
that fit the criteria.  Then emails are sent out to the people corresponding
to those profiles/agents.

An example:

Someone posts an ad saying they have a car for sale:

MODEL: Chevy
MAKE: Silverado
YEAR: 2005

Meanwhile, potential clients have saved search agents so that when a car is
posted if the description meets their criteria they are sent an email. Thus,
you could have three people, each with agents such as these:

PERSON1
MODEL: Chevy
MAKE: Silverado
YEAR (Newer than): 2003

PERSON2
MODEL: Chevy
MAKE: Any
YEAR (Newer than): 2004

PERSON3
MODEL: Any
MAKE: Any
YEAR (Newer than): 2000

You would like all of these people to be emailed after the ad is posted, but
how?  This won't work:

SELECT * FROM agents WHERE mymodel = Chevy AND mymake = Silverado AND
myyear = 2005

It will limit the results too much.  But neither will this:

SELECT * FROM agents WHERE mymodel = Chevy OR mymake = Silverado OR
myyear = 2005

That will give too many results.  If you had a profile such as:

PERSON4
MODEL: Chevy
MAKE: Corvette
YEAR (Newer than): 2003

They would be sent the email, too.  But they aren't looking for trucks.

Two options I see would be to:

1) Do it in reverse.  Each time a new ad is posted to then loop through the
agents doing a search for the criteria and limiting the search to only the
previously posted ad, such as:

SELECT * FROM ads WHERE admodel = Chevy AND admake = Silverado AND
adyear = 2003 AND adid = 8

2) Create some crazily complex query with nested ands and ors out the wazoo.


Is there something I'm not seeing?  Is there a better way?  If not, which of
these seems like less of a strain on the server?

TIA.  Hopefully I'm not just being an idiot here.

Nick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Filemaker Checkbox Data Problem...

2005-03-31 Thread Nick Zukin
I've got a client who uses Filemaker Pro and I'm trying to parse some of
their data.  However, the checkbox data of theirs is giving me fits.  From
what I've read, it's supposed to save checkboxes as data separated by
carriage returns.  However, in looking at the data in EditPlus I can't
discern what they are and in trying to parse them with str_replace I've had
no luck searching for \r \n \r\n or anything else.

Anyone else had this misfortune?

TIA,

Nick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Filemaker Checkbox Data Problem...

2005-03-31 Thread Nick Zukin
Just tried a str_replace using chr(29) and it didn't work.  Thanks for
trying so quickly, though.

Nick

-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 12:43 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Filemaker Checkbox Data Problem...


Nick Zukin wrote:
 I've got a client who uses Filemaker Pro and I'm trying to parse some of
 their data.  However, the checkbox data of theirs is giving me fits.  From
 what I've read, it's supposed to save checkboxes as data separated by
 carriage returns.  However, in looking at the data in EditPlus I can't
 discern what they are and in trying to parse them with str_replace I've
had
 no luck searching for \r \n \r\n or anything else.

If this is these 'repeating fields' I had to deal with a few months
back, it's some special character.  You can make this character in php
with

chr ( 29 );

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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



RE: [PHP] Filemaker Checkbox Data Problem...

2005-03-31 Thread Nick Zukin
Will do.  The only funky workaround I've found so far is just pasting the
character into a str_replace.  It appears as a little unknown character box
in both EditPlus and Dreamweaver.  What's funny, though, is that if I try to
paste it as part of the line here in Outlook 2000 like this:

$mystring = str_replace(
, , , $mystring);

It breaks the line up, apparently creating a carriage return.  Ugh.  I'd
sure like to find a less hacky way to do it.  I've done a lot of googling
and haven't found anything yet.

Nick

-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 1:16 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Filemaker Checkbox Data Problem...


Nick Zukin wrote:
 Just tried a str_replace using chr(29) and it didn't work.  Thanks for
 trying so quickly, though.

 Nick

Good luck.  Filemaker has some wierd stuff in it.  If you find the
answer away from the list, please let us know, as some of us are stuck
with working with it too. :(

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
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



RE: [PHP] PHP-NUKE

2005-03-21 Thread Nick Zukin
There is a lot of information like this at nukecops.com, too, btw.  You'll
want to start here:

http://nukecops.com/forum2.html

Nick

-Original Message-
From: Armando Afa [mailto:[EMAIL PROTECTED]
Sent: Monday, March 21, 2005 12:19 PM
To: php-general@lists.php.net
Subject: [PHP] PHP-NUKE


Hi,

I've already downloaded ver 7.2 of php-nuke, but it does not tell how to
install it on Windows environment. Can somebody tell me where did I go
wrong? I've have always follos the instruction manual but it does no work
with IIS

Thanks in advance, once again
Armando

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Searching Multiple Columns, Multiple Tables in MySQL...

2005-03-11 Thread Nick Zukin
Sorry if this is too DB oriented.

PHP 4.3, MySQL 3.23

I've got a somewhat complex search of a MySQL database I'm trying to make.
(At least it's complex to me.)  And I'm wondering if it's better to try to
handle it in MySQL or to split it up into multiple processes using PHP.

Essentially, I have three tables: vendors, products, and a join table for
vendors and products:

VENDORS
---
vendorid INT
vendorname VARCHAR
vendorcategory VARCHAR

PRODUCTS

productid INT
productname VARCHAR
productcategory VARCHAR

JOINS
-
xid INT
xproductid INT
xvendorid INT

I want to be able to do a keyword search of sorts with a list of vendors as
the result.  However, I want one value from a form to be used to search
three columns in two different tables: vendorcategory, productname, and
productcategory.  Of course, the join table would have to be used to make
sure that the product names and categories that match give corresponding
vendors.

There's probably some method of using MySQL to do this with one query, but
it's beyond me.  And experience tells me that sometimes it's easier or
better to use PHP (or even necessary to use PHP) to get the results how I
want them, often splitting complex queries into two parts.

Any suggestions?

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Undefined Variable Problems...

2005-03-06 Thread Nick Zukin
Sorry if this has been covered before.  I just joined this list.

My host just upgraded PHP to 4.3.10 from 4.1.2.  A couple of my clients are
using systems such as PHP-NUKE or various message boards.  I hadn't been
paying attention to my log files, but all of a sudden they got huge,
especially the error logs.  They're filled mostly with undefined variable
errors, but also a couple others, for example:

[Sun Mar  6 00:35:50 2005] [error] PHP Notice:  Undefined variable:
forum_admin in /home/scott/.org/html/mainfile.php on line 79
[Sun Mar  6 00:35:51 2005] [error] PHP Notice:  Undefined offset:  1 in
/home/scott/.org/html/mainfile.php on line 486
[Sun Mar  6 00:35:51 2005] [error] PHP Notice:  Undefined index:  2 in
/home/scott/.org/html/mainfile.php on line 216

line 79, if ($forum_admin == 1) {
line 486, $uname = $cookie[1];
line 216, $pwd = $user[2];

Line 79 is not part of a function or class.  It is the first reference to
$forum_admin in the script.  The other two are within functions and the
first call within those functions.  What's being assigned to both of them
are either in the function call itself or globals.

I do have globals turned on.

Should I worry about any of this?  The pages seem to be working fine?  Is
this going to slow things down?  Should I just turn off the logging of such
errors, if I can?

Thanks for any help.  My log files are in the gigabytes with 90% of that
over the last month.

Nick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Undefined Variable Problems...

2005-03-06 Thread Nick Zukin

Sorry, as I said, I just joined and I didn't notice that it's set to
reply-to the original sender rather than the list.  A bit annoying.

Thanks again.

Nick

-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 06, 2005 1:10 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Undefined Variable Problems...


Please keep responses on the mailing list / newsgroup...

Nick Zukin wrote:
 Thanks for the quick response.

 Yes, had to turn register_globals on because it broke things.  Many of
these
 sites aren't mine and I have no idea what's involved in trying to fix them
 all.  If you saw a full 1.2 GB error log (per domain) that built up to
that
 size in less than a month, though, you'd see that it would take a lot of
 re-coding.

 Assuming I can fix the pages that break when register_globals turned off,
 how big a deal are the undefined variables?

If you can manage to turn register_globals off that would be the most
important thing.  Undefined variables aren't necessarily bad, but they
can lead to obscure bugs (for example, if a variable is set inside of an
included file instead of a main script where you thought it was unset).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php