Jump to content

aunquarra

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by aunquarra

  1. I've found a need to have an LDAP directory, and I'm trying to get PHP to support it, but I keep getting this configure error, no matter what I do. checking for LDAP support... yes checking for LDAP Cyrus SASL support... no configure: error: Cannot find ldap libraries in /usr/lib. From what I can tell about looking at the configure script, it's looking for a shared object file named libclntsh. However, when I try to "locate libclntsh", I can't find it either. In my Googling last night and this morning, the closest thing I could find was here: http://www.oreillynet.com/cs/user/view/cs_msg/14233 Fortunately for php (but unfortunately for me), this was a bug in the configure script that got address many versions ago (I'm trying to install 5.x.x). So far, I've tried to configure 5.1.4 (which is already up and running without ldap) and 5.2.1 (the latest version as of now), and both have given me this error. I'm sure it's not PHP directly. Clearly, it's looking for a file that isnt' there, but since I'm new to LDAP, I'm not sure why it's not, or what should have installed it. So far, I've installed the openldap, openldap-server, openldap-client, and openldap-devel packages. Unless I'm mistaken (and I very well could be), that's all I need, but clearly something was missed. And all I can find when I Google is stuff relating to Oracle, which is definitely not my issue (no Oracle on this box). Any general direction would be greatly appreciated.
  2. Perfect! Not sure why I didn't think of that, but thank you!
  3. Okay, I have two tables I frequently join. One is a list of people, and the other is a list of details about those people. I typically do the joins with the id number in the people table and a column with people IDs in the details table. So it would be like... SELECT `people`.*, `details`.* from `people` left join `details` on `people`.`id`=`details`.`people_id`.... The trick is, as you might guess by the way I'm building it, each people_id could have multiple rows in the details table. Typically, I only call on the details table when I'm looking at one specific person, so no biggie there. But in this case, I need to retrieve a list of people. What I'm wanting to accomplish is to, without resource-heavy sub-selects, return only people who don't have a specific detail. So like, if I'm looking for people who are unemployed, and the way I tell if a person is employed is to check and see if they have a row in the details table that has a `detail_category`='job', then to return a list of unemployed people, I have to check to see if they don't have such row. The more I think about it, the more I think this isn't going to be something I can do with a simple join. Either I'm going to have to have PHP do the legwork or do a subselect. But I figured I'd ask the professionals...
  4. My plan was to have JS or whatever client-side code is running post the x and y position to a form and submit. Then, I'd use PHP to superimpose an X or whatever over the spot, then they'd click the other corne, which would post in the same manner. It's not as intuitive as I'd like, but when you know no client-side stuff at all, you do as much with server side as you can.
  5. I'm working on a php-driven integrated image upload/control system that generates various image sizes, which in and of itself is pretty simple. What I'm working on now is making the thumbnail generation a user-interactive system. Specifically, they can pick a region of the image to be targeted for the thumbnail. On the php side, this, again, will be relatively simple. But the only option I've found for picking the target area is to image map every pixel so I know where a person clicked for the corners of the target area. So much for efficiency. So I figured javascript could have a much more efficient solution, and to my surprise, I found no help from the Oracle (what my wife and I call Google). Does anyone here know a way javascript can post an X and Y position of an image to a form onClick?
  6. Right, but the benefit of trying to find a way to do it in mySQL rather than PHP is that sorting columns in mySQL is much easier (on both the programmer and the server). ;) Since it's not possible, I'll just have everything else be sortable and just plug the count values in with PHP.
  7. Meh. Okay, so I'll just do it with php. I can deal with the count not being sortable. Thanks for all your help! I actually understand joins a lot better now (so much so that I've used them on several other pieces of this project already).
  8. Sure... Here's the mysqldump: [code] CREATE TABLE `items_keywords` (   `id` int(11) NOT NULL auto_increment,   `item_id` int(11) NOT NULL,   `keyword_id` int(11) NOT NULL,   PRIMARY KEY  (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='keywords assigned to a given item'; CREATE TABLE `keywords` (   `id` int(11) NOT NULL auto_increment,   `keyword` varchar(20) NOT NULL,   `desc` varchar(100) NOT NULL,   PRIMARY KEY  (`id`),   UNIQUE KEY `keyword` (`keyword`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='assignable keywords'; INSERT INTO `keywords` VALUES (1,'brown','This is the color brown. You know, like chocolate.'),   (2,'black','This is the color black. Licorice anyone?'),   (3,'orange','This is the fruit orange. Bet you thought it was going to be the color...'),   (4,'green','This is the color green. Is it envy, lust, or money?'); INSERT INTO `items_keywords` VALUES (1,1,2),(2,1,4),(3,2,3),(4,3,1);[/code] And with that data, here's how my query stands now: [code] mysql> SELECT k.keyword, k.desc, COUNT(*) AS counter FROM keywords AS k LEFT JOIN items_keywords AS ik ON (k.id=ik.keyword_id && ik.item_id='1') GROUP BY ik.item_id; +---------+----------------------------------------------------+---------+ | keyword | desc                                              | counter | +---------+----------------------------------------------------+---------+ | brown  | This is the color brown. You know, like chocolate. |      2 | | black  | This is the color black. Licorice anyone?          |      2 | +---------+----------------------------------------------------+---------+ 2 rows in set (0.00 sec) [/code] And here's what I'm going for: [code] mysql> SELECT <magic query here>; +---------+---------------------------------------------------------------------------+---------+ | keyword | desc                                                                      | counter | +---------+---------------------------------------------------------------------------+---------+ | brown  | This is the color brown. You know, like chocolate.                        |      0 | | black  | This is the color black. Licorice anyone?                                |      1 | | orange  | This is the fruit orange. Bet you thought it was going to be the color... |      0 | | green  | This is the color green. Is it envy, lust, or money?                      |      1 | +---------+---------------------------------------------------------------------------+---------+ 4 rows in set (0.00 sec) [/code] where the 'counter' is the number of times the keyword_id is in the items_keywords table WHERE item_id=1 Thanks again for the help. This has been a real learning experience.
  9. Right now, here's how my query is set: [code] SELECT k.keyword, k.desc, COUNT(*) AS assigned FROM keywords AS k LEFT JOIN items_keywords AS ik ON (k.id=ik.keyword_id && ik.product_id='3') GROUP BY ik.product_id [/code]
  10. Hmmm... Then it counts the NULL values together as an ik.item_id. So instead of one row for each k.keyword with a 0 as the count, I get one row with the first k.keyword value, and a count of all the other NULLs.
  11. Well, I'm really trying to get a number of matches. If there aren't any, I'd like it to still show up, but with '0' as the result.
  12. Okay, I figured I'd update this post rather than posting a new topic since this is kinda related. I tried to use your query as a guide for doing a lookup for a specific item, but it's not quite working the way I saw it in my head. I'm looking to return something like this (using data from above table): [code] Query: SELECT ??????  ik.item_id=3  ????? +----+---------+----------+ | id | keyword | selected | +----+---------+----------+ |  1 | brown  |        1 | |  2 | black  |        0 | +----+---------+----------+ [/code] Of course, if there's artifact data in the return (like a column with the item_id in each row), that's fine. I can deal with that. I just need to make sure these three columns are there. So far, here's what I have. The problem is that it only returns keywords that match the item_id. If the keyword_id isn't in the items_keywords table next to the item_id, it doesn't show up. [code] SELECT k.keyword, k.desc, COUNT(*) as selected from keywords as k left join items_keywords as ik on k.id=ik.keyword_id where ik.item_id='3' group by ik.keyword_id order by keyword[/code] Again, I had originally planned to do the legwork in PHP, but with mySQL, I could sort based on the selected column.
  13. That worked! Seems to be pretty clean with demo data. We still have to see how it scales, but looks good so far! Thanks!
  14. Basically, I have two tables like this: [code] table name: keywords +----+---------+ | id | keyword | +----+---------+ |  1 | brown  | |  2 | black  | +----+---------+ table name: items_keywords +----+---------+------------+ | id | item_id | keyword_id | +----+---------+------------+ |  1 |      1 |          1 | |  2 |      2 |          1 | |  3 |      1 |          1 | |  4 |      3 |          1 | +----+---------+------------+ [/code] I'm prepared to do the work with PHP, but I wanted to see if mySQL could do this more efficiently. Basically, I want to do some kind of "SELECT * from keywords" that would also include a count(*) from items_keywords where keywords.id=items_keywords.keyword_id. I'm just starting to learn my way around joins, and I've found in some applications, it's more efficient to just let mySQL do the work rather than adding other table values to PHP arrays. Just want to see if this is possible in this scenario.
  15. Did I post this in the wrong section? Should this go under PHP Help?
  16. This seems to have been posted in the wrong section. I apologize. I have reposted it under PHP Help. The original post is here: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--][!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]Hello all. This is my first post in this particular section, but I'm sure you guys will be as ever-helpful as the other folks have been, and for that, I thank you in advance. Basically, my question is simple: is there a way for my php script to convince apache that an http auth procedure has already taken place? I've built a session-based login system, passing a $_GET session_id() key around from page to page. It works pretty well, and after doing it on four separate sites now, I prefer it to using http auth. The main downside, though, is that with http auth, it's easy to see who is logged in by checking the apache logs (since the username is logged), and I can't do that with this system. So, I'd like to somehow use my html login page rather than the pop-up http auth window, still base the whole login scheme on the mysql/sessions system it's on now, but tell apache that the username is $_SESSION['username']. I've tried manually setting the $_SERVER['PHP_AUTH_USER'] var, etc., but of course, that information doesn't pass on to the next page, much less apache itself. It may not be possible, but if it is, I know someone here will know how to do it. Thanks so much! [!--sizec--][/span][!--/sizec--]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.