Jump to content

slushpuppie

Members
  • Posts

    63
  • Joined

  • Last visited

    Never

Everything posted by slushpuppie

  1. seriously... it's like you regex guys are not human... i can never comprehend how your patterns work, but they always seem to... thank you.
  2. i have a variable called $raw, which is a string of html code i pull in from another source. however i need to make any relative links like: <a href="pageOne.html">Page One</a> into complete pathed links, like: <a href="http://www.domain.com/pageOne.html">Page One</a> right now i am doing this: $patterns[0] = '/<a href="/'; $replacements[0] = '<a href="http://www.domain.com'; $raw = preg_replace($patterns, $replacements, $raw); which IS working, however i'm sure any of you looking at this can see it's inherent flaws... like if the link markup is: <a style="color:red;" href="pageTwo">Page Two</a> my pattern would not catch that. it will also put http://www.domain.com at the start of any link that may already start with a domain. what i need is a patern that would find any link that does not have http:// or https:// at the beginning of the href, and would put http://www.domain.com at the start of it, while leaving any other attributes of the a tag along. the $raw variable is coming from a consistent source, so i know that just adding the http://www.domain.com to the start of the hrefs will do what i want it to do, with that the path will be complete. any help or insight would be GREATLY appreciated. thank you.
  3. i string variable with some html in it. i want to be able to delete all code before "<div id="someName"> and after "<!-- end someName -->". so essentially just strip out a all the stuff around a certain div. any pointers? i saw something like this: /^[^@]+/i in another thread to get all stuff before the @ symbol... do i need something similar? replace the @ with my div???
  4. was just thinking, a simple textual explanation might help... for this issue there's a table of `games`: `id`, `game_title` a table of game `ratings`: `game_id`, `user_id`, `rating` and a table of `users`: `id`, `username`, `banned` what i want to do is get a list of all games, and an average of their ratings, but not include the ratings if the `banned` value in the `users` table is set to 'yes'. can anyone point me in the right direction as far as how to join up in this method? thanks so much. psuedo: selecting from `games joining `ratings` based on the `game` `id` joining `users` based on the `ratings` `user_id`???
  5. this is what i get on an EXPLAIN (i apologize if the formatting from this site makes it hard to read): id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE u ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort 1 SIMPLE users_ratings ref user_id user_id 4 SERVER.u.id 1 1 SIMPLE vc_games eq_ref PRIMARY PRIMARY 4 SERVER.users_ratings.game_id 1 also - i am able to get the query to return the desired results if i remove the RIGHT JOIN ("RIGHT JOIN `users` `u` ON `u`.`id` = `users_ratings`.`user_id`") and of course the WHERE clause that's associated with that... however the query will return ratings for users with banned accounts, which was the reason the RIGHT JOIN is in there. thanks very much for your reply.
  6. i'd make a table like: `id`, `product_name` - which would have one entry for each product and then another table with: `product_id`, `historical_price` - which would point to the `id` from the products table that seems to make the most sense to me.
  7. moving a site onto a new server running mysql 4.1.11, where as the old box was running 4.1.22, here's the query that's giving me trouble: on the old server (4.1.22) it'd return every game whether or not it had been rated yet (`users_ratings`). it would simply return NULL as the value for `score`. however on this new server (4.1.11) it doesn't return any results where there isn't a rating, so any game that has not been rated isn't showing up in the list. this is the structure of the databases. anyone have an idea of why it isn't working on the new server? is this just a case of it accidentally working in 4.1.22? is there something in 4.1.11 that i need to specify to get it to handle the NULL in `score` differently? would appreciate any help - hopefully this data will be useful, let me know if any other info is needed! thanks so much.
  8. i've recently coded a social networking site, which hopefully will catch on. right now there are very few users, around 100 total. i've got a messaging system, and a notification system, which alerts you when a friend adds you, when you're invited to something, etc... the client would like the user to be able to check a setting where they also get an email letting them know they have a new message or notification waiting for them on the site. my question is whether i should have my application send an email when the message/notification is created, or perhaps should i insert a record into a database table and setup a cron job to query that table and mail all the emails out at once? any input as to why one method would be better than another? thanks so much.
  9. thanks! i will check out these values. the database is a mixture of innoDB and MyISAM.
  10. working a site that has quite a large database: 125 tables ~93,935,032 records 46.7G it's indexed quite well i believe, but sometimes it'll hit a query that's causing other queries to be queued up and brings the whole site down. they are queries that'll usually run just fine, but under some circumstances, which i believe are based on the serverload - it can't handle it. one of the common situations is when a table with 4.0M records needs to join with a table with 15.1M and another with 6.2M at the same time. the database is on it's own server, which is a pretty solid server. 4 processors: Intel® Xeon® CPU E5430 @ 2.66GHz 16G of ram nothing else served from it besides this database i know this isn't the most descriptive post, but is anyone out there running stuff on the same size/scope or larger? any tips/ideas/suggestions?
  11. i have a query that is similar to this (only much more complex so i won't bother writing it out): SELECT `one`, `two`, (`three` + `four`) FROM `table` WHERE (`three` + `four`) < 25 is there a way i can set (`three` + `four`) to something, so that i can only reference it like: SELECT `one`, `two`, (`three` + `four`) AS `XXX` FROM `table` WHERE XXX < 25 (i know the above doesn't work, but i'm looking for something similar to it, where i can write out the equation once and then reference it).
  12. gizmola - thanks. we're going to do our best to get the client to allow us to redirect all her domains through one address. thanks again.
  13. i have a site with several domains, which the client insists upon keeping available... so rather than have domain.net and domain.org just redirect to domain.com, they want you to be able to visit any of them via that url. however many people post links in the forums on the site, which go to domain.com or www.domain.com, and if you're logged in on anything other than where the link goes you are seen as an invalid user and required to login on that domain. so for example, i go to domain.com, login, and then click on a link to www.domain.com/awesome_page - i get an error that i'm not logged in and have to login again. i've read some about how you can set the session_cookie to ".domain.com", but what about if i'm on domain.net? any ideas? any input at all? i'm kind of at a loss, and don't want to try implementing anything with my current level of understanding of this issue. thanks in advance.
  14. i have a table with a column called 'asker' and 'asked', which is keeping like a "buddy list", so it's storing user ids from another table. i want the pairs to be unique - in my application it really doesn't matter who is the asker and who was asked. so for example: uid 1 asks uid 8 to be their friend, so i put in 1 | 8 into the table. i set a UNIQUE index on those two fields, which prevents me from inserting 1 | 8 again, however 8 | 1 can be added, which i don't want to happen. so my question is basically is there a way to set this logic on the database level? or will i need to do this in my application code? thanks
  15. php will always do it's processing on the server and send the html over in one chunks... if you've ever tried to do: header('location: somewhere.php') after echoing or outputting any html or blank spaces you'll see this in action...
  16. your email server (aol.com) might be blocking it before it even gets to your mailbox to put into a spam folder. i've had issues with aol in the past. i'd try it on a different address. i didn't try your code, but going through it quickly it looks sound. so i'd check the issues with email itself. it could be because it's coming FROM some other url that where your site is... i believe that's part of the reason so many sites send from "do-not-reply@domain.com", and then you can just do a REPLY-TO piece in your header so that when you click the reply button it'd go there.
  17. that is the exact problem... thank you so much. i've never actually worked with a site utilizing register_globals on, because it's been considered "bad" since i was still in school. now i know... and i wonder how long ago this code was actually written... if it's that old or if it was just done using bad practices.
  18. i'm trying to help someone fix some code we 'inherited'... i know any of you will stop reading right there, but to those that continue on: this code is not very pretty, but it's been working. and basically it seems that yesterday (new year's day) a bunch of the sites stopped working. i'm sure this is purely coincidence, but basically here is what's happening. the admin pages all go through index.php, and within index there is something like: if ($urlAction=="page_edit") include "page_edit.php"; else if ($urlAction=="page_update") include "page_update.php"; and $urlAction SHOULD BE set to $_REQUEST['urlAction']... but this appears no where in the code, also if i add in a line like $urlAction = $_REQUEST['urlAction']; above the ifelse, that part WILL work, except any time variables are supposed to be set to request variables there is no declaration i can find of it. i'm not sure what version of php this was initially built for, but it was ported over to our server and seemed to be working fine for a week or two, and then just stopped yesterday (when no one was even in working on it). is there some old deprecated way that you could set a variable named the same as the request variable without actually declaring it? like any way that $item could equal $_REQUEST['item'] without actaully setting $item equal to it somewhere? i don't see any loops that create/set variables or anything. one of the pages a form submits to has nothing but: $result = mysql_query("UPDATE customers SET BILL_TITLE='$billTitle', BILL_LAST_NAME='$billLast' .................. and a redirect. i do not see a single place that $billTitle could have been set (it is found no where else in the code at all).... banging my head against a wall here trying to figure out what the issue could be... any input would be appreciated.
  19. i know this is an odd question, and isn't the best approach, but i'm using existing database structure and don't want to alter it for fear of ruining anything in existing code. but anyway, i have a database table that is essentially ID | Name and i have a query, where i'd like to return the ID's in a non-logical order, like 3,4,2,1,5,6,9,8,7 - is there anyway to simply do that in an ORDER BY clause? if not - i'll add a column to the table called "order_by" or something and insert values, but figured i'd ask i guess this could be useful again somehow. thanks.
  20. do you mean check which card i can put in... as in it's physical shape? like pci? or does it need to be the same make/model as the other one? does it need to use the same video driver?? thanks.
  21. my computer now has dual monitors from one video card (one vga and one dvi output). however i have an extra 20" monitor here at my desk that's doing nothing. would i be able to throw in a second video card and easily be able to do a 3 monitor setup? does windows have support for this? i'm running windows xp. thanks.
  22. the first method you suggested is faster, with the AND in the ON
  23. Showing rows 0 - 29 (161 total, Query took 12.8863 sec) query still took quite a while(but your method is definitely faster), i'll have to do some testing to see if your method or my php method will be easier on the server.
×
×
  • 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.