Jump to content

Oldiesmann

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Everything posted by Oldiesmann

  1. The only way you can do this is to put the php include inside the proper section of HTML code (I'm not real familiar with frames, so I couldn't tell you exactly how to do it).
  2. While it is possible to pull all the info in a single query, it would be a bit easier to do it in two queries, and you're still going to have to use PHP to sort all the data out... First get all the team names and find out how many games there were... Then, find the number of wins for each team Put all the wins in an array, using the team names as the keys Sort the array in reverse order (so the team with the most wins will be first) Use a foreach loop to calculate the losses for each team and display the info Basically, something like this: $query = mysql_query("SELECT home_team FROM table ORDER BY home_team ASC") or die(mysql_error()); $num_games = mysql_num_rows($query); $team_data = array(); while($teams = mysql_fetch_assoc($query)) { $current_team = $teams['home_team']; // Find all the wins... This is tricky... $query2 = mysql_query("SELECT COUNT(home_result) AS home_wins, COUNT(away_result) AS road_wins FROM table WHERE (home_team = '$current_team' AND home_result = 'Win') OR (away_team = '$current_team' AND away_result = 'Win') or die(mysql_error()); // Calculate the wins $wins = mysql_result($query2, 0, 0) + mysql_result($query2, 0, 1); // Now that we have this info... $team_data[$current_team] = $wins; } arsort($team_data); foreach($team_data AS $name => $games_won) { // Figure out how many games they lost $games_lost = $num_games - $games_won; // Put whatever code you want here to output this info... } There might be a way to do all that in one query, but it's easier to do it in two queries.
  3. You have a typo in your code - $sq1 instead of $sql
  4. You might also find the Information Schema helpful
  5. Your best option would be to use CSS. See http://www.w3schools.com/css/css_border.asp for more info.
  6. To communicate between the two, you will need to use either a third-party database class (such as ADODB) or one of the PHP extensions that supports both Access and MySQL (such as ODBC or PDO). I'm not real sure how you connect to Access databases from PHP, but basically what you'll need to do is this: Pull the data from MySQL into PHP variables Pass the data (using those variables) to Access after modifying it (if needed). I honestly don't understand why this is necessary - I realize that Access isn't really designed for web databases, but why do you need both Access and MySQL? Also, Microsoft Excel will open CSV files, so that might be an easier way to do things.
  7. "spleblem_games3.categories" means it's trying to look for a "categories" table in the "spleblem_games3" database. Can you post the code you're using?
  8. I don't think having 24 columns vs 24 rows would make much of a difference in terms of table size (you're still storing the same data). However, I would recommend doing one row per hour rather than one row per day. 24 columns would make things really confusing, and you'd need other columns besides one for each hour (one to uniquely identify each row, one to keep track of which day it was, etc.).
  9. Make sure you're either replacing the line breaks with <br /> (PHP's nl2br() function will do this), or that you're using double quotes around the value: echo '\n'; - literally displays \n echo "\n"; - outputs a linebreak
  10. PHP needs to be compiled with "--with-pgsql" for pg_connect() (and other PostgreSQL functions) to work. Either your host doesn't support PostgreSQL, or they forgot to compile PHP with PostgreSQL support (in which case they should be willing to recompile PHP to fix this issue).
  11. I would suggest having a couple additional tables: Customers - A table containing information about all your car owners: Customer_ID First_Name Last_Name Address City State Zip Home_Phone Work_Phone Other_Phone Cars - A table containing information about all the cars: Car_ID Customer_ID Year Make Model Color Then, modify your logs table like this: ID Customer_ID Car_ID Service_desc Date_service Or, if you'd like to take it one step further, come up with a list of unique service codes (short text strings that uniquely identify each service) and add a services table: ID_Service Service_Code Service_Desc Then you could replace "service_desc" with "Service_code" and have even less info. This will help you minimize the duplicate info stored in particular tables, while increasing flexibility.
  12. Googling for "mysql visual basic vista" (without the quotes): http://www.codeproject.com/useritems/VBnet_to_mySQL_Server.asp
  13. No matter what you do, there will always be a way around it, and it will only annoy and frustrate your users.
  14. The conditionals were invented by Microsoft, and therefore will only work for Internet Explorer. You will need to check the user agent string to handle other browsers.
  15. Replace "url_to_image" with the actual URL to the image. (If you're wondering how I did that, I used a special tag called "nobbc" - anything within the nobbc tags will not get parsed as bbcode).
  16. I would suggest asking on the ImageMagick forums. ImageMagick is a separate graphics library that doesn't have anything to do with PHP.
  17. The setting is mysql.default_socket, not mysql.default.socket. Also, make sure you reboot Apache after making changes to php.ini.
  18. Add GROUP BY players.player_id to the query (after the WHERE clause) and it will work.
  19. MySQLi is only available with PHP 5.0.0 or higher, so if your host doesn't have it, they're most likely not running PHP5. Ask them to make sure they're running the latest versions of PHP (5.2.3) and MySQL (5.0.45). The only other extension that offers the same advanced features is the "PDO" (PHP Data Objects) extension, but this has pretty much the same requirements as MySQLi, so if your host doesn't have MySQLi, then chances are PDO won't work either.
  20. First: Subtract the last active timestamp from time(). Then, check it against various values: Less than 60 = seconds Less than 3600 = minutes Less than 86400 = hours Less than 604800 = days Etc. $active = time() - $last_active; if($last_active < 60) { $last_active_string = $last_active . ($last_active == 1) ' second' : ' seconds'; } elseif($last_active < 3600) { $last_active = (int) ($last_active / 60); $last_active_string = $last_active . ($last_active == 1) ' minute' : ' minutes'; } elseif($last_active < 86400) { $last_active = (int) ($last_active / 3600); $last_active_string = $last_active . ($last_active == 1) ' hour' : ' hours'; } elseif($last_active < 604800) { $last_active = (int) ($last_active / 86400); $last_active_string = $last_active . ($last_active == 1) ' day' : ' days'; } ... That's pretty basic, but should give you a good idea.
  21. There are several problems with that code... $query = "" - this will always set $query to an empty string. Because you're not using ".=", $query will always get overwritten each time. You can only have one WHERE keyword in a query - any other conditions must be appended using AND. You can't just stick NULL in a query by itself. It's relatively easy to fix all of those issues, but the fix mainly depends on whether or not only one variable will be set at a time.
  22. <?php $ref[0] = "gen 1:12"; $ref[1] = "exo 2:31"; foreach($ref as $value){ echo '<a href="www.find.net/CP/Search/rsearch.php?submit=true&searchtype=All+Words&search=&wholeword=Whole+words+only.&table_display=true&lookup='.$value.'">'.$value.'</a>'; }; ?>
  23. 1&1 has a reputation for being one of the worst hosts in the industry. Avoid them at all costs. One of the biggest issues is that they're overselling - there is absolutely no way they can afford to offer 300GB of space and 3TB of bandwidth for $20 a month - the largest hard drive I can find online is 3TB (3000GB) - and that costs $6000. If you do a little googling, you'll find all kinds of horror stories about poor customer service, unannounced changes, etc. I know someone who was hosted with them years ago. It got to the point where the entire site would go down with "CPU Limits Exceeded" errors as soon as there were 10 users online (the forum was integrated with the site). I finally convinced him to move away from 1and1, and he hasn't run into that problem at all since then - even though the forum is much busier now than it was at the time.
  24. MySQL is not case-sensitive, so yes, it will still get found no matter how they type it.
×
×
  • 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.