Jump to content

metalblend

Members
  • Posts

    89
  • Joined

  • Last visited

    Never

Everything posted by metalblend

  1. See http://www.phpfreaks.com/forums/topic10214.php.
  2. ..read the error message: duplicate key A primary|index key\'d column cannot have duplicate entries, meaning that if you\'ve used a 0 for your id column, 0 cannot be inserted again. If this is an auto_increment\'ing column, you don\'t even need to set the id column, as MySQL will insert the next value automatically. Use a different value for id each time you insert into the database. Hope that helps.
  3. You\'ll want to read about the mod_autoindex module: Apache 1.3 : http://httpd.apache.org/... Apache 2.0 : http://httpd.apache.org/... * specifically the AddDescription and IndexOptions directives. Hope that helps.
  4. ..had to edit that and change to CODE tags. phpBB\'s PHP tags destroy & and && operators
  5. The error means your host does not allow you to include remote files. You\'ll need to use relative paths instead. Hope that helps.
  6. ..not too sure if this bit of code will speed the process, but is shorter and (in my opinion) the safer way to go: <?php $id=mysql_connect(\'host\',\'username\',\'password\') or die(mysql_error()); mysql_select_db(\'databasename\',$id) or die(mysql_error()); $rs = mysql_query(\'SELECT name FROM table_name\',$id) or die(mysql_error()); while($row = mysql_fetch_array($rs,MYSQL_ASSOC)) echo \'<option value=\'\' . $row[\'name\'] . \'\'>\' . $row[\'name\'] . \'</option>\'; ?> Hope that helps.
  7. Using the method I gave earlier: <?php $query = mysql_query("SELECT username,class,level FROM sh_player WHERE dead=\'0\'"); $total = mysql_num_rows($query); echo \'<table><tr><td><b><font size="2" face="verdana" color="#6699CC">Name</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC"><b>Class</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC"><b>Level</b></font></td></tr>\'; while($row = mysql_fetch_array($query,MYSQL_ASSOC) { echo \'<tr><td><font size="2" face="verdana" color="#6699CC">\' . $row[\'username\'] . \'</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC">\' . $row[\'class\'] . \'</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC">\' . $row[\'level\'] . \'</font></td></tr>\'; } echo \'</table>\'; ?> or using your mysql_result() method (which still results in more code): <?php $query = mysql_query("SELECT username,class,level FROM sh_player WHERE dead=\'0\'"); $total = mysql_num_rows($query); echo \'<table><tr><td><b><font size="2" face="verdana" color="#6699CC">Name</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC"><b>Class</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC"><b>Level</b></font></td></tr>\'; for($i=0;$i<$total;$i++) { $username = mysql_result($query,$i,\'username\'); $class = mysql_result($query,$i,\'class\'); $level = mysql_result($query,$i,\'level\'); echo \'<tr><td><font size="2" face="verdana" color="#6699CC">\' . $username . \'</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC">\' . $class . \'</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC">\' . $level . \'</font></td></tr>\'; } echo \'</table>\'; ?> Hope that helps.
  8. You are using 3 queries: SELECT username FROM sh_player WHERE dead=\'0\' SELECT class FROM sh_player WHERE dead=\'0\' SELECT level FROM sh_player WHERE dead=\'0\' A quicker method, for both the script and the server, is to use 1 query to return all of the results: SELECT username,class,level FROM sh_player WHERE dead=\'0\' then loop through the results. You\'ve made it harder than it needs to be.. look into that.
  9. Why must you use 3 queries where 1 would generate the same result?
  10. metalblend

    php myadmin

    MySQL is not included with PHP.. just support (meaning the mysql_ functions are built-in). MySQL Download: http://www.mysql.com/downloads/mysql-4.0.html
  11. Actually there are a few things wrong.. try this: <?php $query = mysql_query("SELECT username,class,level FROM sh_player WHERE dead=\'0\'"); $total = mysql_num_rows($query); echo \'<table><tr><td><b><font size="2" face="verdana" color="#6699CC">Name</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC"><b>Class</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC"><b>Level</b></font></td></tr>\'; while($row = mysql_fetch_array($query,MYSQL_ASSOC) { echo \'<tr><td><font size="2" face="verdana" color="#6699CC">\' . $row[\'username\'] . \'</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC">\' . $row[\'class\'] . \'</font></td><td>\'; echo \'<font size="2" face="verdana" color="#6699CC">\' . $row[\'level\'] . \'</font></td></tr>\'; } echo \'</table>\'; ?> Hope that helps.
  12. The code works fine.. this is a server issue.
  13. Remember, ORDER BY is fairly new to UPDATE queries (introduced in 4.0.0).. be sure your host has MySQL 4 or later. Other than that, there are no syntax errors in your query.
  14. We discourage double-posting.. http://www.phpfreaks.com/forums/topic7776.php
  15. If the class is written in its own file (which it should naturally be ) you would include it, otherwise the class can be defined in the script itself. It looks like you might be missing that file.
  16. As I had expected, your class is not defined or has not been included. Have you created this DB_Notdienst class? If so, you\'ll need to include() the source so the script can find the class and use your query() method. If you need more help, let us know. Hope that helps.
  17. This is under PHP, right? The error is specific to the script attempting to initiate (call) a class and it did not exist. Something like this would be the cause for error: <?php class boo { # php, and more php here } $var = new boot; ?> A simple typo is to blame (here). Can we see some code?
  18. Without trying to find the simplest way to \"beat the system\", can I click multiple times a day or is there some system which only logs unique hits?
  19. Just for reference, the error : Warning: Supplied argument is not a valid MySQL result resource means one thing.. you tried to retrieve results where the query returned FALSE (failed). With knowledge of the built-in MySQL functions you\'ll notice that when you query the database, you will get 1 of 2 possibilities returned: a) a mysql result resource/link B) FALSE [boolean] A simple way to avoid getting this error is to perform some error checking before attempting to retrieve the results: if ($result != FALSE) { #do this } else { # do this [error] } This method will save you debugging time in the future.. probably a good idea to start doing it. Hope that helps.
  20. I\'ve never seen this topic discussed before.. from what I\'ve learned, MySQL is technically an open-source relational database system. The differences are marginal, but I stand on the RDBMS side.
  21. Wow.. this query is indeed corrupt, but in a small way. The brackets {/} should be parenthesis (). The correct way of implementing this (without possible error) would be: CREATE TABLE `news` ( `id` int( 10 ) NOT NULL auto_increment, `title` varchar( 100 ) NOT NULL , `text` text NOT NULL , PRIMARY KEY ( id ) ) Hope that helps.
  22. Actually it\'s much simpler than you think.. break from the string: $query = "INSERT INTO application_form (something, email) VALUES (\'something\',\'".$_POST[\'Email\']."\')"; Hope that helps.
  23. The server which hosts the file most likely has the directive register_globals off, which is the new configuration for PHP 4.2.0 and later. Read more about the alternative here: http://www.php.net/manual/en/reserved.variables.php I have configured your code to work fine on my server.. it runs a rather old version of PHP, which is why I have to use $HTTP_{method}_VARS method more commonly used. Here\'s the working copy.. fill out the form and the source is displayed on the next page: http://code.phirebrush.com/ref/httpvars.php Hopefully you find what sections you need to remove.. if not, let us know. Hope that helps.
  24. Try this: $mysql = mysql_connect("localhost", "doomflam_admin", "PASSWORD") or die("Could Not Connect To Database!"); mysql_select_db("doomflam_forum",$mysql) or die("Unable To Locate Database!"); $query = "SELECT username FROM phpbb_users"; $setquery = mysql_query($query) or die("Query failed!"); if (mysql_num_rows($setquery)>0) { while ($res = mysql_fetch_array($setquery)) { print $res[\'username\']."<br>rn"; } } else { print "There are no entries!"; } Hope that helps. You can break it down if you need to customize it.. let us know if you need more help. edit // posted late.. either method will work.
  25. You would not need to use strpos().. like shiva said, use str_replace()
×
×
  • 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.