Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. You'll likely need to include PDO::FETCH_ASSOC within all your fetch() for it to work properly. see here: http://php.net/manual/en/pdostatement.fetch.php
  2. OK, firstly - the plural of dice is die Secondly - this looks more suited to the freelance section, as you are effectivly asking somone to write a self contained pice of code for you, not fix a problem with some existing code of your own. However, could you clear up the formaula: "- A string describing the dice [0-9] + d [0-9 ]+[+-][ 0-9] + size (d <number_of_dices> <number_of_sides> [+-][modifying_value])" as to what d is refferencing and what dictates the <number_of_die> and <modifying_value>? And also what do you meen by " - The result should always be a positive number, which is not greater than twice of the result we got."
  3. Try: function currentstales() { global $read_only_db; $currentshares = 0; $lastwinningshare = $this->lastWinningShareId(); if (!($currentshares = getCache("pool_stales"))) { $sql = "SELECT count(id) FROM shares WHERE id > $lastwinningshare AND our_result='N'"; $result = $read_only_db->query($sql); if ($row = $result->fetch(PDO::FETCH_ASSOC)) { $currentshares = $row[0]; setCache("pool_stales", $currentshares, 300); } } return $currentshares; }
  4. well no, because to reitterate the car scenario the question would then need to be "are the doors open - true or false" which is obviously just daft. Tt would be, if anything "are the doors closed - true or false" maintaining the consistancy. I'm not arguing the logical assignment of boolean values, just saying that sometimes overall context is relevent to what is used.
  5. any chance of posting your acctual code?
  6. Because if a status of "closed" is actualy a positive (desired) value in the context of the program then it would clearly be more logical to have it set to boolean 1. without knowing what the overall obgectives are you can't apply a generalisation of positive and negative outcomes to the values used. If I want to check a car before it drives away and see if the doors are open or closed I would clearly use 1 to represent closed because that would be the desired positive status to progress with the final action.
  7. search the forums for "pagination" you should get the full 1000 results.
  8. you need to use a conditional check to see if you are going to output the catagory name or not : $i = 0; $cat='new'; while($row = $this->db->fetch_assoc($query1)) { $content .= ($i % 2 == 0 ? '<tr class="odd">' : '<tr>'); if($cat != $row['cat_name']){ $cat = $row['cat_name']; $content .= '<td><p><a href="index.php?cg=cgs&page=forum&do=forums:'.$row['cat_id'].'">'.$row['cat_name'].'</a></p>'; } $content .= ' - '.$row['forum_name'].'</td>'; $content .= '</tr>'; $i++; } That should work, it's untested so may need a little tweeking.
  9. This has obviously no impact, and as long as you remember your own logic everything will always work, but I just thought I would mention that when using Booleans (value 1 or 0), the "normal" logic is that 0 is false, closed, inactive, no, negative, etc... and 1 is true, open, active, yes, positive, ... You seem to be using the inverse: 1 for closed, 0 for open. That really depends on the context of the output. If "closed" is the desired value, or the result of a successfull operation then 1 would be more applicable.
  10. Here is where you would alias your field names, and not use SELECT * SELECT table1.id AS table1_id, table2.id AS table2_id ... FROM table1, table2 WHERE ...
  11. UAC is that annoying "Are you the one who wanted this to happer" message that was introduced with Vista and can be modified with the control panel -> users settings. Folder/file permissions can be checked by bringing up the security tab of the folder/file properties. As you havn't set Apachi or PHP users I would recomand that you make sure that the security settings include "Everyone" and set it "Read & Execute" if you are in a network environment or if you are in a trusted location "Full Control" would make absoloutly certain.
  12. Yeah, you're not too clear on this one. Is it right to say that: You are rinning a SELECT on a table, displaying the results in a tabled form. Now you want to have the form data update the table that you have SELECTed from when the form submit button is clicked? Is that about right?
  13. Does PHP have explicit read permissions on that folder/file? Have you dissabled UAC in Vista?
  14. you need to start by assigning ID's you your form elements. Then you need to perform a SELECT query on the database that you are looking up - would suggest calling a seporate query PHP page with the Jscript using URL fed variables - then have the Jscript feed the results into the form elements using the ID's that you gave them.
  15. You could try the following: DELETE staff.*, staff_address.* FROM staff, staff_address WHERE (staff.id NOT IN (SELECT staff_id FROM staff_address)) OR (staff_address.staff_id NOT IN (SELECT id from Staff) I doubt that will work though, and if it does I'm not sure what it will actualy perform, I have never tried to simultaniuosly delte from two tables whilest using a cross reffence check on just those tables. I personaly would use two DELETE queries - one for each table - in this case.
  16. ... GROUP BY row_item_id ORDER BY id DESC, row_item_id ASC Is that what you're looking for?
  17. seriously, going to need to see the up to date code page that you are working on. either post it up, or add it as an attachment or there's not much can be done.
  18. For multiple choice filtering you need to dynamicaly genarate the WHERE clause in your PHP depending on options chosen. You will need a bunch of if conditions and a check to see whither the chosen option is the first chosen option, or if there is another before it.
  19. The code I was asking for was the revised page that is giving you the problem, howerver, you will need to add quotes to the following: <form action=members.php method=post> // becomes <form action="members.php" method="post"> add the quotes, and then if it's still not working please post up your full revised code so we are both working off the same page (literaly). Also, if there are any errormessages or other bits of information they would be helpfull too P.S. I'm so far from being an expert it's not even on the horizon
  20. No one else pointed out that you are using double wild cards from the root? You are actualy telling the script to look in every subfolder of / so it's guarenteed to pull A & B, if you run the A script it will also pull in A & B. You will need to code some conditional logic to determin which you want, or change it to be ./A/*.listing and ./B/*.listing for the appropriate index.php files.
  21. Cut and paste your HTML so that is is AFTER your header scripts. You can NOT run a header once output has been sent to a page (regardless of if you can see it or not).
  22. you didn't even read my post, did you?
  23. yeah, could you fling up said code? Also - is your limit hard set to 2 or is it coming from a variable?
  24. how certain are you that there should be multiple rows returned? what do you get if you use echo mysql_num_rows($result) ?
  25. Strange....works fine for me SELECT set1 FROM sample WHERE id IN (1,2,3,4,5,6) LIMIT 2 Returned only 2 values. What context are you running this query in?
×
×
  • 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.