Jump to content

kevisazombie

Members
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

kevisazombie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey PugJr, Thanks for the feedback. The image probelm was a big issue. Where and what browser did you notice this privacy policy glitch?
  2. Hi all We recently launched http://www.digizal.com it is an all purpose app discovery site. Modeled after apples design. We are looking for some feedback on the site. Please acknowledge any features you think the site is lacking as well.
  3. Okay I canned the whole mysql idea and just made an array of random integers the same length as the results from the query and matched them up
  4. Here is a simplified query of something I am trying to do on a larger join query. It is still breaking on this small scale. I am trying to generate a random number for each row pulled back in the range of 1-60. I then want to order the returned rows by this random number. SELECT downloads . * , (FLOOR( 1 + ( RAND( ) *60 ) )) AS randomtimer FROM downloads ORDER BY randomtimer LIMIT 25 I have 2 databases I have tried this query on. A live one and a dev one. I have side by side compared the two and they are both structurally the same. It works correctly on the dev one. returning the rows ordered by the randomtimer. The live table returns all 1's in the randomtimer column. If I order by randomtimer ASC they become all 60s. If I remove randomtimer from the Order By Clause it returns correct individual values. So something is tweaking the values on the ORDER BY statment. Anyone have any ideas on this? Might I be overlooking something? WTF? WTF?
  5. The php rand() solution doesn't work. As it is out side of the mysql and i need a random number generated for each row. It just pulls one random number and applys it to all rows. I can't pull the random number outside of the query as I am going to use it in an ORDER BY statment. I think my query might have other issues here is the whole thing SELECT * FROM ( SELECT downloads.date, products.*, FLOOR(1 + (RAND() * 60)) AS timer, ( SELECT COUNT( * ) FROM distros WHERE distros.product_id = products.product_id AND distros.compatibility_id = 1 ) AS distro_count, (SELECT COUNT(*) FROM downloads WHERE downloads.product_id = products.product_id) AS true_downloads FROM downloads INNER JOIN products ON downloads.product_id = downloads.product_id ) AS count_table WHERE count_table.distro_count > 0 AND count_table.active = 1 ORDER BY count_table.timer , count_table.date DESC"; LIMIT :count;
  6. Thanks laPistola, no luck though still getting all 1s I am on mysql 5.0.75
  7. HI all, I am trying to generate a random integer for each row I select between 1 and 60 as timer. SELECT downloads.date, products.*, (FLOOR(1 + RAND() * 60)) AS timer I have searched and keep coming up to this FLOOR function as how to select a random integer in a range. This is giving me a 1 for every row. What am I missing?
  8. Hi all, I am getting this error "Unknown column 'distros.id' in 'where clause'" From the following query. I know the error is coming from the second line where I am trying to do a count on the distinct_downloads subquery. I need the sub query's distros.id to match up with the outer query's corresponding row distro.id. I'm not that sharp on mysql, this query is probably poorly written. Any other tips would be greatly appreciated SELECT DISTINCT downloads . * , products.title, products.company, categories.category_name, compatibilities.name AS compatibility, distros.distro_type, distros.filename, distros.url, (SELECT COUNT( * )FROM (SELECT * FROM downloads WHERE downloads.distro_id = distros.id AND downloads.ip_address != '127.0.0.1' AND DAY(date) = DAY(CURDATE()) GROUP BY distro_id, ip_address) AS distinct_downloads) AS downloads, FROM `downloads` INNER JOIN products ON downloads.product_id = products.product_id INNER JOIN distros ON downloads.distro_id = distros.id INNER JOIN categories ON products.category_id = categories.category_id INNER JOIN compatibilities ON compatibilities.compatibility_id = distros.compatibility_id WHERE ip_address != '127.0.0.1' AND DAY(date) = DAY(CURDATE()) GROUP BY distro_id, product_id ORDER BY DAY(downloads.date), downloads DESC LIMIT 0 , 15
  9. Hi all, I have searched and cannot find a simple straight answer. What is the preferred datatype for storing a url in mysql?
  10. Here is a .htaccess I use for a web app. it remaps all incoming urls to the .index.php as path variable simillar to what you are trying. example: http://www.mydomain.com/category/test ends up as: http://www.mydomain.com/index.php?__page=category/test/ You will probably need to change the rules at the end around to be page instead of __page and maybe change up the images/css/js part ################################################### # Turn the RewriteEngine on. # ################################################### RewriteEngine on ################################################## # Properly rout for other web apps # ################################################# ################################################### # Do not process images or CSS files further # ################################################### # No more processing occurs if this rule is # # successful # ################################################### RewriteRule (images|css|scripts|js)/(.+)$ $1/$2 ################################################### # Add a trailing slash if needed # ################################################### # If this rule is used, the rewriting stops here # # and then restarts from the beginning with the # # new URL # ################################################### RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L] ################################################### # Rewrite web pages to the index page # ################################################### # No more processing occurs if any of these rules # # are successful # ################################################### #RewriteRule ^(.*)/?$ /index.php?__page=$1&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/?$ /index.php?__page=$1&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7/$8&%{QUERY_STRING} [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7/$8/$9&%{QUERY_STRING} [L]
  11. Sorry I kind of simplified my example. Where I have the index.php listed in my directory structure I am actually hosting a pretty big web application. The web application runs on this MVC frame work that uses a .htaccess file to remap all incoming urls to index.php as GET variables. For example http://www.mydomain.com/twiki ends up as http://www.mydomain.com/index.php?1=twiki So the web app will not redirect to the twiki directory and will come back with an error as there is no controller for twiki. Currently I have the twiki directory under Public_Html and have modified .htaccess to direct accordingly. I would however like to keep the twiki out of the web apps files, and out of the public_html for organizational purposes. I thought this might be easy as my hosting provider has a cpanel directory setup behind the public_html which http://www.mydomain.com/cpanel is directed to. I'm thinking I would need to edit the apache config and add an alias or something. Also I suppose I could make a twiki controller for the web app which would redirect accordingly.
  12. Hi All, Is this possible? I have my site in a directory structure like this: home/ -user/ -user_images/ -user_files/ -twiki/ -public_html/ -index.php I would like to redirect incoming requests for http://www.mydomain.com/twiki to the twiki/ directory. I am not sure if it is possible because it is "behind the wall" in a web inaccessible folder. I am able to access user_images/ and user_files/ through relative urls in php. I was wondering if there was similar way with .htaccess like: RewriteRule twiki/$ ../twiki/
  13. Hi all, I have inherited a project that has a .htaccess file that rewrites all URLS to the index.php file in a query string. I have run in to a problem where using periods in the URLs will throw a 404. I need this functionality for URLs like this: http://www.mysite.com/admin/search/email/[email protected] or: http://www.mysite.com/product/phpfreaks.com_Logo I am kind of green on .htaccess and Regex but I have tried some edits like dropping the \. from capturing groups to no avail. I hope this is an easy fix thanks for any help! AddHandler application/x-httpd-php5 .php ################################################### # Turn the RewriteEngine on. # ################################################### RewriteEngine on ################################################### # Do not process images or CSS files further # ################################################### # No more processing occurs if this rule is # # successful # ################################################### RewriteRule (images|css|scripts|js)/(.+)$ $1/$2 ################################################### # Add a trailing slash if needed # ################################################### # If this rule is used, the rewriting stops here # # and then restarts from the beginning with the # # new URL # ################################################### RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L] ################################################### # Rewrite web pages to the index page # ################################################### # No more processing occurs if any of these rules # # are successful # ################################################### #RewriteRule ^(.*)/?$ /index.php?__page=$1&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/?$ /index.php?__page=$1&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7/$8&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7/$8/$9&%{QUERY_STRING} [L]
  14. To better explain my issue. Using what sdi126 recommend and what I have tried I am getting table rows returned in an order similar to: parent1 parent2 parent3 parent4 child of parent 1 child of parent 1 child of parent 1 child of parent 1 child of parent 2 child of parent 2 child of parent 2 etc.. I am trying to get them returned like this: Parent1 child of parent1 child of parent1 Parent2 child of parent2 child of parent2 Parent3 child of parent 3 child of parent 3 etc...
×
×
  • 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.