Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. In PHP count is a function that counts the items in an array. If you want to SUM the values look into array_sum. But if you just want to count how many items are in the array $cup['score1'], yes that would be the correct method. As far as if you are using it correctly, I do not know and cannot know without more code / an example print_r out of the array.
  2. Please do not double post. If you have new information to add to a topic, do so with a reply (if the edit timeout limit has been reached). Duplicate of: http://www.phpfreaks.com/forums/index.php/topic,305125.0.html
  3. It seems duplicating stuff is in your nature. Please do not repost the same question. Duplicate of: http://www.phpfreaks.com/forums/index.php/topic,305128.0.html
  4. COUNT(*) is generally not a good idea. It is better to put the id field name in there. This will make the query more efficient. To be able to pull the data you want to alias the column: SELECT tablename.val1, tablename.val2, COUNT(id) as id_cnt FROM ... Then you would reference it by $results['id_cnt']
  5. Current Total Votes:<?=totalVotesThree(1) ?> Current Total Votes:<?=totalVotesThree(1) ?> Current Total Votes:<?=totalVotesThree(1) ?> But why are you passing a parameter to the function that you are not even utilizing? Your MySQL is also bad: $query="SELECT SUM(totalvotes) as total_three FROM ".DB_DATABASE.".bonusvotes_2010 WHERE bonusvotes_2010.contestantID IN ('3460,242') AND bonusvotes_2010.status='Valid'" (Removed the =)
  6. That is the proper way to do it. Just make sure that session_start() is at the top of any page you wish to use sessions.
  7. Not sure how you would tell it 3 days, but here is a different way to do it: http://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file
  8. You re-post / bump after 3 minutes? Are you joking? If you want quick service pay someone. As far as why no one wants to answer your problem, with the exception of jd307, is that you failed to provide any code or any attempts you have tried. If you want to pay someone to do this, post in the freelance section, if you really want "help" to code this, well provide us with some code so we can assist you. But I assure you, your topic is not going to get resolved by not posting code and posting a 1 lined message of what you want to do and expect magic to happen. Sure it is possible, you just have to do your research on how, do not expect us to do your own research. A tip, googling for "CSS Active State" will bring up some good tutorials / how to's.
  9. Probably: $review = nl2br($a2[ContentText]); Would be my guess.
  10. It stores the line breaks, HTML just does not convert them to <br /> tags, which is what is required for them to show up (that or encase the text in a <pre> tag). When you pull the data out and get ready to display it, run nl2br on the data and it should convert the line breaks to the HTML <br /> tag. I would not store the data with the html <br /> tags, keep it as line breaks in the database, just an FYI.
  11. I think $ftp_connect should be $conn.
  12. No not really. The main reason people do it is for "SEO" reasons, which only goes so far and for profile information, it really will not matter too much. Now for blog posts it is good to create these "clean" / slug URLs from the title, but again not exactly necessary.
  13. exec or system as long as the file is on the server and the server allows such actions to be taken.
  14. So it did not work? If not, if you can provide the two table structures with (fake of course) test data for both tables, I can help you figure it out. Without it I am just pulling at straws.
  15. e. should be e1. Simple typo.
  16. Ok here is my latest attempt: SELECT p1.rating, MAX(p1.date_of_pr) as date_of_pr, e1.employee_id FROM performance_review p1 JOIN employee e1 ON e1.employee_id = p1.employee_id WHERE e.manager_id = $m_id ORDER BY p1.date_of_pr GROUP BY p1.employee_id, p1.rating; This does have the possibilty of returning multiple rows per employee if two reviews were done on the same day, you will just have to code the PHP the only echo 1 per employee, at least this limits the number of rows returned etc.
  17. Well I am kind of baffled to the point of I do not know what to do. An idea (which is probably a bad idea), is instead of this weird ass query, why not add a column "last_rating" to your employee table and just update that anytime a rating comes in. It would be a solution. The only other way would be to do two separate queries as far as I know, but yea. I am out of ideas for the queries lol. EDIT: Or add a column to the preformance_rating stating active, and always set the last one to the "Active" one (or name the column last_rating) so you can add that to the query.
  18. lol Oh yea. Sorry again: SELECT pr.rating FROM performance_rating pr, ( SELECT DISTINCT pr1.rating_id, pr1.employee_id FROM employee e1, performance_rating pr1 WHERE e1.manager_id = '" . $m_id . "' AND pr1.employee_id = e1.employee_ID ORDER BY date_of_pr) pr2 WHERE pr2.rating_id = pr.rating_id ORDER BY pr.date_of_pr Again not sure if it will work but maybe we are making headway!
  19. Ah, no distinct won't work as it works on all columns returned. Just found that out. Maybe this will work... SELECT rating, employee_id FROM performance_rating WHERE rating_id IN(SELECT DISTINCT pr1.rating_id,pr1.employee_id FROM employee e1, performance_rating pr1 WHERE e1.manager_id = '" . $m_id . "' AND pr1.employee_id = e1.employee_ID ORDER BY date_of_pr) I am unsure if that would work, seems like it might, but yea. Give it a try and see. (Sorry hard to test if I don't have the test data.) And why that is not working for you, anything in the group by has to be returned in the select statement if I remember correctly, but GROUP BY is not what you want. That will still pull all ratings, given you are pulling that column.
  20. SELECT r.rating, DISTINCT r.employee_id FROM performance_rating r, employee e WHERE r.employee_ID = e.employee_ID AND e.manager_id = '" . $m_id . "' ORDER BY date_of_pr Not sure if this will produce constant results, but should only pull out one rating per employee_ID.
  21. It is a bad idea, I would agree. But I have had issues with Drop USER messing up and the only way to remediate was to manually delete it. Since he hinted that he tried the DROP USER command to no avail, I figured that he needed another means of doing it.
  22. You couldn't figure out the new pattern? el sigh. $pattern = '~class="listing-price">.*\$(.*)</h3>~isU';
  23. What do you want, the dollar amount? The 's' modifier will treat the string as one long string / ignores new lines (if my terminology is correct). $pattern = '~class="listing-price">(.*)</h3>~isU'; May give you what you are after, not really sure as you did not specify your expected output..
  24. $filename = isset($_POST['pgnfile'])?$_POST['pgnfile']:null; //trying to call the variable 'pgnfile' from the form above if (!is_null($filename)) { if (file_exists($filename)) { $string = file_get_contents($filename); $output = preg_replace('~{.*}~U', '', $string); $newfile = $filename . "converted"; //trying to append the word converted to the old filename file_put_contents($newfile, $output); echo file_get_contents($newfile); } } Should treat you right. A key note, any variable inside of single quotes is take literally. IE: '$one' would echo $one instead of what was in the variable. Also to access GET / POST data you have to use the superglobal variable $_GET or $_POST
  25. No, it is not correct. if ($state == "texas" || $state == "michigan" || $state == "maryland) { // Yep its a state } Would be "proper". P.S. Maq hates you.
×
×
  • 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.