Jump to content

chrischen

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chrischen's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a table of ITEMS, and a table of SUMS. I would like to display specific items from table ITEMS and also have the sum of specific column in table SUMS that has a foreign key pointing to that item in table ITEMS. So for example lets say ITEMS was a table of websites and SUMS is a table of web traffic where each row is a day and each day has the amount of visitors. Items (Websites) Site_id | Site name | site category 1 | yahoo.com | 1 2 | msn.com | 1 3 | google.com | 2 4 | youtube.com | 3 5 | yahoovideo.com | 3 Sums (traffic) site_id | day | visitors 1 | 1/1/2009 | 851075 1 | 1/2/2009 | 172083 2 | 1/1/2009 | 1750207 2 | 1/2/2009 | 2357 3 | 1/1/2009 | 123 I would like to display a list of sites with category 1 and also display the sum of visitors for that site in one query. Is that possible? I tried querying SUMS table and left joining ITEMS table and used group by, but if there are no rows in SUMS for a particular site then it is not displayed. I would like the site to be displayed even if there are no rows in SUMS pointing to it. Thanks in advance.
  2. Nevermind i just solved it. When the user submits the comments the first time it loads the page again before redirecting and the code to set it to 0 is after the header(location: ) command. I guess php code after that is executed too? Well, I learn something new everyday.
  3. So the user posts a comment and then the $_SESSION['post'] = 1; Then they are redirected to a new page and this code is executed: 1. if($_SESSION['post'] == 1) { //for some reason $_SESSION['post'] is 0 2. $notice .= 'Your comment has been posted!'; 3. echo '<div class="notice green">'.$notice.'</div>'; 4. $_SESSION['post'] = 0; // as long as this line is here post is always equal to 0 5. } However the weird problem is that $_SESSION['post'] is 0 in line one as long as long as line 4 is there. If I remove line 4 then $_SESSION['post'] is 1. However even if I have it equal 123 or another integer on line 4 $_SESSION['post'] still equals 0. Also if I have $_SESSION['post'] equal a string on the first page then it works fine and equals the string on the second page. So basically what's happening is the existence of the code on line four is overriding the value of $_SESSION['post'] to equal 0 as long as it was initially an integer value, even if line 4 is not set to equal 0 (tested line four with a string and it was still overrided to 0).
  4. chrischen

    row count

    Is there a point where mysql_num_rows stops working? And I'm assuming it's faster than summing a value of 1 for each row right?
  5. Ok well, I decided to not use pagination.
  6. I'm trying to create a commenting system that has the ability to nest comments. So basically within the database each comment has a "comment_parent" value pointing to the ID of the parent comment. I use a linked list to organize and return the comments with each child under the respective parent. This works great if I have all the comments on one page. But I need to have some form of pagination and here's where the problem arises. If I paginate by limiting the query then because the child and parent comments may not be together in the database some child responses may be missing if it is not in the query. And if the child response shows up later in a query it will not display because its parent is not there. So basically I need a solution that can display the top level comments by date and show the child and sibling comments while maintaining an X number on each page. And if a child spills onto the next page it should still display. The only solution I have now is to retrieve the top level comments and then have multiple query loops to retrieve each child. But i'm assuming that's not very efficient. Thanks in advance.
  7. I added 127.0.0.1 graphics.polemicpost.com to the hosts file and rebooted the computer. Still gives me Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, info@mytunes.fm and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
  8. Windows and apache. I'll try that and let you know if it works. Thanks.
  9. that's been done. And done in apache virtual hosts config file too.
  10. I found this code: RewriteCond %{HTTP_HOST} !www.polemicpost.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).polemicpost.com [NC] RewriteRule (.*) %2/$1 [L] However it doesn't work for me. I'm trying to have it so that graphics.polemicpost.com refers to www.polemicpost.com/graphics, which is a folder. so graphics.polemicpost.com/photo1.jpg is www.polemicpost.com/graphics/photo1.jpg. Thanks, Chris
  11. Yes they were replaced. And I fixed the problem by adding mysql_query("SET NAMES utf8"); before queries.
  12. No wordpress doesn't. In fact, wordpress is replacing the normal quotes with the smart ones too.
  13. The htmlentities didn't work. All it did was take the html code and convert it. In wordpress I viewed source and the quote that I converted to work is like this “ instead of like this ". This is odd because when I view it on my custom page that retrieves it from the database for it displays as ". For the other quotes I didn't change it displays as a diamond with a question mark even in view source. I checked the database and it's stored like “ too. The wordpress db is utf-8, so the problem is with PHP.
  14. Here's the thing though: wordpress displays them correctly. So there must be a way to do so without modifying the original text.
  15. I have wordpress installed and it displays all character's correctly. However I made a page myself and queried the wordpress database that contained quotes copy and pasted from microsoft word. In my custom page those characters show up as a diamond with a question mark in it. It shows up correctly in the wordpress page so how do I fix this? The html page is set to utf-8 encoding. Thanks, Chris
×
×
  • 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.