Jump to content

blakekr

Members
  • Posts

    19
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

blakekr's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm trying to do a simple(?) task of replacing multiple <br>s in my database with newlines (\n\n). This doesn't involve php at all, it's an existing blog database that needs to be cleaned up. Can this be done within mysql? The best I've been able to do so far is *literally* replace the <brs> with \n\n in the text, instead of linebreaks -- no good of course. Any tips? I looked into chr(10) and chr(13) but didn't have luck, wasn't sure that was the right approach anyway. This is mysql 5.0.67.
  2. Simple and to the point! Thank you so, so, so much.
  3. I apologize in advance for the largeness of this query. I'm using mysql 5.0.67. My problem is that the query below returns duplicate results for the same item if it appears in more than one category. For example I might have product AB-23423 that shows up in categories 16 and 103. With the query below, I unfortunately pull out two copies of that product even though I only want one. SELECT sh_products.id AS id , sh_prod_categories.cat_id AS catid , sh_products.prod_id AS prod_id , sh_products.prod_name AS prod_name , sh_products.prod_vendor AS prod_vendor , sh_products.prod_thumb AS prod_thumb , sh_products.prod_price AS prod_price , sh_categories.cat_title AS category FROM sh_products INNER JOIN sh_prod_categories on sh_products.prod_id = sh_prod_categories.prod_id INNER JOIN sh_categories on sh_prod_categories.cat_id = sh_categories.cat_id WHERE sh_categories.cat_id = 17 OR sh_categories.cat_id = 216 OR sh_categories.cat_id = 16 OR sh_categories.cat_id = 18 OR sh_categories.cat_id = 103 ORDER BY REPLACE(REPLACE(prod_name,'"',''),'\'','') DESC Given that this statement is on the very edge of my abilities already, can someone suggest a tweak that would result in only one result, even when a product appears in two categories?
  4. I have root, and cpanel. Back in the old days when I used to mess around with Apache more regularly, editing the httpd.conf file was simple: you edited it and restarted apache. Now apparently it is more complicated and for the life of me I cannot get changes to "stick" to my vhost in httpd.conf. I am trying to turn off logging (except error) to improve server performance. I have edited: /var/cpanel/templates/apache2/vhost.default and: /usr/local/apache/conf/sites/[myvhost].conf /usr/local/apache/conf/sites/www.[myvhost].conf But whenever I run /usr/local/cpanel/bin/apache_conf_distiller --update and /usr/local/cpanel/bin/build_apache_conf as directed my changes do not make it into or get written out of httpd.conf. How do I get changes in there? It doesn't seem that you can edit log file directives in vhosts using easyapache either.
  5. Someone very good at mysql helped me create an ORDER BY statement that would allow my program to display item names alphabetically without putting items in quotes at the beginning. Works a charm, except I can't figure out how to craft a REPLACE statement that ignores more than one type of punctuation ... e.g. I need to ignore both double quotes and single quotes at least. Here is my original statement -- works great: if ($SortBy == 1) { // Either explicit or default set above $orderBy = "category , REPLACE(`prod_name`,'\"', '') "; Here is my attempt to ignore both double and single quotes, doesn't work as expected: if ($SortBy == 1) { // Either explicit or default set above $orderBy = "category , REPLACE(REPLACE('prod_name','\\\"',''),'\'','') "; Any advice appreciated! Thanks, Blake
  6. How to describe, hmmm ... I'm looking for some kind of php script or snippet that will allow me to compare the similarity of text, percentage wise. Meaning if I have paragraph A and paragraph B and they're substantially similar but not a match, a script that could tell me they are "80% similar." Much like copyscape does, I guess, only probably far less sophisticated. This sounds like something that would be easy to find, but perhaps it's much harder to do than it looks. At any rate I haven't been able to find something like it. Any thoughts?
  7. I have a very long server log file I want to parse with php, but it requires too much memory (I thought) to put it into an array. It turns out, it's requiring too much memory even to open and go through line-by-line, or so it seems ... I get this error ... Is there any of "getting at" and parsing a very long file of this size, or do I just have to delete it?
  8. Aha, thanks so much!! Will try (and mark resolved if I don't have more questions)
  9. Okay, I understand the idea of the "insert into... select..." statement, and the idea of the mysql_select_db function ... but I still can't figure out how to take a few rows in table Foo in database A and copy them into table Foo in database B. Your help appreciated!
  10. After what seems like far too much agonizing, I think I've decided to build my own php "shopping cart" and hack my own interface to paypal IPN, because all the other solutions I've come across are massively oversized and overdeveloped for my needs. But I could use some help in setting up the structure. I'm not sure of the best way to handle "options" with my various products. First of course I set up a basic database with product fields like: [I]sku, price, name, etc. etc.[/I] The tricky part is that some products will have special options, some dropdowns and some text fields, and I know I won't be able to predict all these in advance, like: [I]item color, accessory color, font, initial, initials ...[/I] In addition, some products will call for extra product photos and others won't ... And then I will need some way of storing all these extra options for a given customer's order when it comes through. I know this is probably a pretty common design question. I'd appreciate any hints on how you'd approach it.
  11. I can't believe I couldn't find this answer myself, but all I'm turning up are answers for C programs. How can I tell MYSQL to ignore punctuation when doing its ORDER BY thang alphabetically? All my results in quotations are listed first. I want to preserve the quotations for user-readability, but I sure don't want to sort by them. Appreciate an ???y tips ...
  12. Thanks, I greatly appreciate it and that seems to have gotten me over the hump!
×
×
  • 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.