Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. trq

    isset()

    To do that your going to have to do it the hard way. however, before going down that path, I would put it to you that your database is poorly designed. Why would you have 5 fields all containing the same or similar data? I should have mentioned this in my previous post. Any time you see field names like..... row1, row2, row3, row4 in a database says its a poor design. Look up some tutorials on database normalization and come back when your data is stored properly. Actually, you probably won't need to because a simple query will get you the answers you need. That's one of the benefits of good DB design.
  2. trq

    isset()

    mysql_fetch_assoc() returns an array just like mysql_fetch_row() does. *assoc returns an associative array though while *row returns a numerically indexed array so your syntax would fail because the cnt index does not exist. And in both cases there is no need for any while loop. Maybe you where thinking of.... $sql = "SELECT COUNT(*) AS cnt WHERE 'YES' IN(rowBa, rowBb, rowBc, rowBd, rowBe)"; if ($result = mysql_query($sql)) { echo mysql_result($result, 0); } which is shorter, but IMO less clear.
  3. trq

    isset()

    <?php $sql = "SELECT COUNT(*) AS cnt WHERE 'YES' IN(rowBa, rowBb, rowBc, rowBd, rowBe)"; if ($result = mysql_query($sql)) { $row = mysql_fetch_assoc($result)) { echo $row['cnt']; } }
  4. Re-organie your code. Think about it, why output any html if all your going to do is redirect the user to another page.
  5. I would start by moving your css into an external file and indenting your code consistantly. You should also be alot more consistant with your capitalization in your css. Finally, your assigning classes to your divs without ever using them. Most of these classes' could be changed to id's.
  6. This topic has been moved to Linux. http://www.phpfreaks.com/forums/index.php?topic=317079.0
  7. If your trying to login as root you need to use roots password. If you haven't set a password for root yet, it may be still blank. Try.... mysql -uroot at a terminal.
  8. trq

    isset()

    What does your table structure look like? And what fields might contain the word 'YES'?
  9. trq

    isset()

    Because.... $result = array_count_values($Array1); if (isset($result['YES'])) { $points = $result['YES']; } is more efficient.
  10. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=317065.0
  11. trq

    isset()

    Can you actual explain (in English) what it is your wanting to achieve? Your code is terrible. If you can explain (without examples because they are not helping at all) your goals, we might be able to help you right some decent code.
  12. trq

    for-loop

    No. Read the previous two replies.
  13. trq

    for-loop

    Using variable variables is inefficient and makes your code allot harder to read. They are better avoided.
  14. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=317034.0
  15. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317016.0
  16. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=317036.0
  17. Http doesn't work like that. All headers + content needs to be sent in one go. You can try playing around with output buffering (see ob_flush) but at best it will be unreliable.
  18. The problem is that the path to the ini file is defined at php's compile time, so, php is looking for the php.ini in the old location. You should be able to make a symlink (from old location to new) to the php.ini which will fix the problem.
  19. This topic has been moved to Linux. http://www.phpfreaks.com/forums/index.php?topic=317047.0
  20. $.post provides exactly the same callback functionality.
  21. If you pass in a third argument to your success function it will be the XMLHttpRequest object.
×
×
  • 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.