Jump to content

metalblend

Members
  • Posts

    89
  • Joined

  • Last visited

    Never

About metalblend

  • Birthday 08/07/1984

Contact Methods

  • AIM
    mfmetal84
  • Website URL
    http://www.phirebrush.com

Profile Information

  • Gender
    Not Telling
  • Location
    California, USA

metalblend's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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.
×
×
  • 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.