Link to home
Start Free TrialLog in
Avatar of hAhA
hAhA

asked on

my sql question, should be easy

hey I have another question, I cannot figure out what's wrong with my php, here is the php, and the link where I am trying to use it:
--------
<table width="100%" border="1">
<tr><th>ID<th>Image<th>Name<th>Base HP<th>Base MP<th>Active
<?
include 'db.php';
function x_dir($param)
 {
    $dir   = opendir($param);
    $files = array();
    while ($ff=readdir($dir))
          {
          if ($ff!=".." && $ff!=".")
             {
             $files[count($files)]=$ff;
             }
          }
   return $files;
 }
$result = x_dir("enem/");

for ($i=0;$i<count($result);$i++) {
     echo '<tr><th>'.$i.'<th width="50"><img src="enem/'.$result[$i].'"><th>';
          $products=array();
          mysql_select_db($database_name,$connection) or die ("bad select DB ".mysql_error());
          $query="select * from usersenem;";
          $result=mysql_query($query,$connection) or die ("bad query $query. ".mysql_error());
          while ($res=mysql_fetch_array($result)) {
            $enem_name=$res["enem_name"];
            $enem_hp=$res["enem_hp"];
            $enem_mp=$res["enem_mp"];
            $ID=$res["id"];
          }
          echo $enem_name.'<th>'.$enem_hp.'<th>'.$enem_mp;
}
?>
</table>

--------
http://phpwarz.cscomps.com/admin.php

thanks in advance, im still trying to figure out these mysql tables : \
Avatar of Jonza
Jonza

what is the problem you are having?

try using
this
while ($res=mysql_fetch_assoc($result)) {


instead of this
while ($res=mysql_fetch_array($result)) {

thjen you can access the records the way you are trying
ASKER CERTIFIED SOLUTION
Avatar of VGR
VGR

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hAhA

ASKER

thanks, both of you, but I figured out what the hell I was doing and got it to work before you responded : )